I’ve recently written a Windows service and installed it on the production system. After some applied Windows updates, the server had to be rebooted and my service did not load correctly, although it was set to start automatically. The service started fine manually after we were noticed of the failure by customers. After some research, I found out that I missed to add a service dependency to our service. So the boot order of the services was wrong for our case.
I could fix the issue, but I’m now really interested in a tool or procedure on how to collect all necessary service dependencies. Do you know any piece of code which can handle this?
I appreciate any hint.
How would a tool know which services you need? By analyzing the source code? By running your service until the service fails?
The only way to make this work is to know the services on which you depend and add them to the registry when you install your service.
I’m not saying that it would be impossible to automate this; but if it could be automated, then Windows would already be doing it: When connecting to another service, Windows could stop your startup until that other service is available.