I’m writing a series of Windows services. I want them to fail if errors are thrown during startup (in OnStart() method). I had assumed that merely throwing an error in OnStart() would do this, but I’m finding that instead it ‘Starts’ and presents me with a message stating ‘The service has started, but is inactive. Is this correct?’ (Paraphrase). How do I handle the error so it actually fails to start the service?
I’m writing a series of Windows services. I want them to fail if errors
Share
if you are running .NET 2.0 or higher, you can use ServiceBase.Stop to stop the service from OnStart. Otherwise call Stop from a new thread.
ref [devnewsgroups] (http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic50404.aspx)(news group gone)