Windows Service with dependency cannot start automatically

startupwindows-server-2012windows-service

I have Service B that is dependent on Service A. Both services are set for automatic(delayed) start upon boot and both services have set Recovery Action of restart in case of first, second and subsequent failures.

The scenario is:

  1. Windows is booting.
  2. It tries to start Service A.
  3. Service A crashes upon start because it cannot initialize (e.g. connect to remote database).
  4. Recovery Action kicks in and windows keep starting Service A at some intervals.
  5. Service A finally starts fine (e.g. remote db is now accessible).

And that's it, Windows doesn't bother to start Service B despite it having Automatic (delayed) startup type.
I'm confused a bit with this behavior. Is there anything I can do to make windows start Service B ?

Best Answer

Service A would not attempt to start if there was a dependency set among the two services. You need to add dependency if it is not there.

sc config ServiceB depend= ServiceA

*How to add dependency on a Windows Service AFTER the service is installed

Related Topic