I have a windows service, that makes several COM+ calls during initialization. On some systems this windows service causes a deadlock during startup.
At least one service or driver failed during system startup
The problem with calling CoCreateInstance during service startup is that it might require other services to startup. And the SCM will not allow other services to startup while waiting for the current service to enter running state. The solution is to ensure that the service dependencies are properly configured when installing the service. See http://support.microsoft.com/kb/258943
But what services dependencies should one specify when running on Windows Vista / 2008 / 7 ?
Another solution is to not initialize your COM objects during your service startup logic at all. Have the startup logic create a separate worker thread, or at least a delayed/queued request to itself, so the COM initialization can be done after the SCM has been freed to start the other services as needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With