Prasanth V J
Prasanth V J

Reputation: 1196

Windows service is not starting automatically after installing

I have created a windows service with automatic starting enabled.When i installed the service using installutil it is not starting automatically.But when i tired to start it manually it is working.

When i checked event viewer i couldn't find any error in it.What would be the issue. How can i find the error?

My start function is like this

 protected override void OnStart(string[] args)
    {
        StartFetch();
    }

    private static void StartFetch()
    {
        try
        {

            FetchManager fetchManager = new FetchManager();
            fetchManager.Run();
        }
        catch (Exception ex)
        {
            throw ex;             
        }
    }

Upvotes: 0

Views: 1698

Answers (1)

KingCronus
KingCronus

Reputation: 4519

Automatic Start refers to what happens on a Windows Reboot. It doesn't automatically start the service on install.

To get around this you can of course add a post-installation event to start the service, which is what I do with mine.

There is also the 90's solution of course, ask the user to reboot to complete installation ;-)

Upvotes: 3

Related Questions