|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
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 themethod, 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, 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.