Service start while dependency stopped
I have installed an application as a service and set the "DependOnService" to be dependent on MSSQL$SQLEXPRESS. In the Properties -> Dependencies tab of my service, "SQL Server (SQLEXPRESS)" is listed as "This service depends on the following system components:". All seems fine. However, if I stop the SQL Server (SQLEXPRESS) service and start my service, it starts up just fine (except that it can't reach the database).
I expected my service to either a) not start because SQL Server is not running, or b) cause SQL Server to start up so that my service could start. But SQL 开发者_Python百科Server is still not running and my service is.
Am I misinterpreting the meaning of dependencies on services and mis-reading the documentation? I tried setting the ErrorControl value as high as x03 and it still starts up. Any explanation, ideas or suggestions would be helpful.
Don't hack the registry! If you want a service to depend on another service, ask the service manager to set the dependency. For example:
sc config MyService depend= MSSQL$SQLEXPRESS
精彩评论