If my Windows services hosting NServiceBus endpoints (Azure Service Bus transport) are set to automatically start, then when our servers reboot, several of them fail to start with the messages in the Windows System Log:
A timeout was reached (30000 milliseconds) while waiting for the XXX service to connect.
The XXX service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.
If I set them to Automatic Delayed Start, they seem to start okay. Has anybody else seen this behavior?
That is normal behavior. When windows is booting, a lot needs to be done. All services set to “auto” get the signal to start at the same time, but due to the high load, some take longer to start than others.
So, if your service needs other services (like SQL Server, MSDTC, some web service hosted on the same machine, …) it can happen that your service is already running, while its dependencies are not, giving you the errors you see in the Windows Log.
When installing a service, you can tell Windows what other services it needs. Then Windows will make sure your service is only started when its dependencies are running, or even start them first if they aren’t.
If you are not sure what other services it needs, the easy option is to set it to “auto delayed”. These services only get the signal to start, when all “auto” services are running.