Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows can't start service

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.

like image 398
East of Nowhere Avatar asked Jul 11 '12 20:07

East of Nowhere


People also ask

Why would a Windows service fail to start?

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.


1 Answers

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.

like image 100
oleksii Avatar answered Sep 29 '22 19:09

oleksii