Windows service fails to start, with generic error

Chris O picture Chris O · Jan 18, 2011 · Viewed 9.8k times · Source

I wrote a trivial NT service using VS2010 and it does install on my XPSP3 dev box just fine, using InstallUtil. However when I run net start TestService I get a generic error:
The TestService service failed to start due to the following error: The system cannot find the path specified.

This same error is also written to the Event System Log, unfortunately with no more details as to which specified path net start didn't like. So I ran Filemon, but no luck there, none of the output could shed any light on my failing service.

The service runs under the Local Service account.

Any tips for debugging this problem?

EDIT: Thanks to all for the tips. DLLs were fine, catch blocks not kicking in, I had try/catch blocks around InitializeComponent, and OnStart methods. The below-mentioned statements of checking the path was the tip-off. I've made an obvious mistake, I had run InstallUtil on my binary from a SUBST'ed drive, which reported success for some reason. Running InstallUtil from a local path fixed my problem, the service now starts correctly.

Answer

John picture John · Jan 18, 2011

First verify that the service is installed properly using sc qc TestService Verify that this is a full path name (starting with drive letter) and try to run the executable from the command line.

If the above works, I would try to check permissions on the executable file.