I am developing an app to install & run as a Windows service. It's still buggy and stopped unexpectedly (leaving nothing in the Windows Event log either) and when I tried to start it up again I got the error
Windows could not start the {name of service} service on Local Computer. Error 1067: The process terminated unexpectedly.
I restarted the computer (Server 2008 R2; a virtual machine, in case that makes a difference), no help. Uninstalled and reinstalled my service, and still get that error!
Something on the machine needs cleared out / refreshed so that it will attempt to start the service again. I don't want to rebuild the whole virtual machine but I'm out of ideas.
UPDATE
I forgot to mention that this Windows service -- exact same code & install -- is running on 3 other machines without the above error. Putting in that debugger in OnStart() still sounds like the way to go though.
Why will my Windows Service not start? Make sure that the service's dependencies are running. Make sure that the service is not set to DISABLED. Sometimes when the service is set to log on as the local system account (default) for some reason, perhaps local permissions, it is unable to launch.
If you have access to the code, you can add a method Debugger.Break
at the first line of the OnStart
method.
Once you "break" into the application investigate where the exception is thrown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With