Troubleshooting: Debugging Windows Services
When you debug a Windows Service application, your service and the Windows Service Manager interact. The Service Manager starts your service by calling the OnStart method, and then waits 30 seconds for the OnStart method to return. If the method does not return in this time, the manager shows an error that the service cannot be started.
When you debug the OnStart method as described in the topic Debugging Windows Service Applications, you must be aware of this 30-second period. If you place a breakpoint in the OnStart method and do not step through it in 30 seconds, the manager will not start the service.