Posts Tagged ‘servicename’

Exception: Error 1083: The executable program that this service is configured to run in does not implement the service.

September 30th, 2010

In short: verify that the service name is correct.  Totally correct.

Longer:

Debugging windows services written in dotnet can be hard.  They have no GUI and have to be installed by a semi secret process.  Then they have to be started by a system call.  And if the start fails it is not necessarily possible to uninstall the service without rebooting.  The CL.exe doesn’t work and hacking the registry doesn’t work.

Today I spent hours tracking down a bug that surfaced with a “Error 1083: The executable program that this service is configured to run in does not implement the service.” when starting the service.  In the end I found out that the ServiceName was incorrect.

To be honest I got some clues, in one place it said MyMailer instead of MyMailerService.  I couldn’t be sure if this was correct or not since I had inherited the project and my search turned out nothing so I dropped it.

By (almost) chance I checked into the automagically created MyMail.designer.cs file and noticed this.ServiceName=”MyMailer”.  Which, it turned out, was the culprit.

I learned a trick on the way.  The service has 30 (I believe) seconds to start.  If it doesn’t fulfill it is shot down by Windows.  When I started the process it failed and I got a question whether I wanted to debug it.  Unfortunately it takes more thatn 30 s to open my VS2010.  So I started VS as administrator (necessary in Win7) and loaded the project.  When I then started the service I got the question whether to attach and I did.  Two seconds of work and I got a highlighted row at the exact point.