I have a c# application that runs as a service and starts automatically. This service starts fine if you manually start it, but fails with this error (The service process could not connect to the service controller) in the Event Viewer on one particular Windows Server 2008 R2. I tried it on a 2nd Windows Server 2008 R2 VM and it started up automatically fine. What specifically causes this error?
This service has no dependencies, the correct permissions, and simply reads a tiny config file, and starts a thread so it won't be taking longer than 30 seconds as this post alludes to http://social.msdn.microsoft.com/Forums/en-US/dc177c75-b41b-4ff7-ae67-9ad60919e507/my-windows-service-is-not-starting-when-the-system-boots-up-even-though-it-is-set-to-automatic?forum=netfxbcl.
I have a debug statement as the first line of OnStart() that never outputs to the log file (I'm using Log4Net). I have a log statement in the Main() before ServiceBase.Run() gets called which is outputting to my log file, so I know logging is working.