简体   繁体   中英

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;             
        }
    }

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 ;-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM