I have a windows service programmed in vb.NET, using Topshelf as Service Host. Once in a while the service doesn't start. On the event log, the SCM writes errors 7000 and 7009 (service did not respond in a timely fashion). I know this is a common issue, but I (think) I have tried everything with no result. The service only relies in WMI, and has no time-consuming operations. I read this question (Error 1053: the service did not respond to the start or control request in a timely fashion), but none of the answers worked for me.
I Tried:
- Set topshelf's start timeout.
- Request additional time in the first line of "OnStart" method.
- Set a periodic timer wich request additional time to the SCM.
- Remove TopShelf and make the service with the Visual Studio Service Template.
- Move the initialization code and "OnStart" code to a new thread to return inmediately.
- Build in RELEASE mode.
- Set GeneratePublisherEvidence = false in the app.config file (per application).
- Unchecked "Check for publisher’s certificate revocation" in the internet settings (per machine).
- Deleted all Alternate Streams (in case some dll was marked as web and blocked).
- Removed any "Debug code"
- Increased Window's general service timeout to 120000ms.
Also:
- The service doesn't try to communicate with the user's desktop in any way.
- The UAC is disabled.
- The Service Runs on LOCAL SYSTEM ACCOUNT.
I believe that the code of the service itself is not the problem because:
- It has been on production for over two years.
- Usually the service starts fine.
- There is no exception logged in the Event Log.
- The "On Error" options for the service dosn't get called (since the service doesn't actually fails, just doesn't respond to the SCM)
- I've commented out almost everything on it, pursuing this error! ;-)
Any help is welcome since i'm completely out of ideas, and i've been strugling with this for over 15 days...