Windows Service dependency problem
-
I have written a windows service that starts automaticaly on windows boot and it do some jobs. If I restart PC, or if I log off and then log on again my service is still started but is not working anymore. My service use another service that is written from another manufacturer (this service can open communications to some hardver devices and communicate with them). It seems that on booting my service starts before that service it depends on, so it is not working (I suppose that is because on starting my service call that custom service to open communication to devices and after restart or log off I lost these opened communications to hardware devices that are controlled by that custom service). How I can set that my windows service depends on this service? (I know the path of EXE file of that custom service and this service is listed in services.msc). I see in C# initialization of windows service array ServicesToRun - so how I can reference and load that service I depend on to load before my service)? I hope that it will resolve my problem...
-
I have written a windows service that starts automaticaly on windows boot and it do some jobs. If I restart PC, or if I log off and then log on again my service is still started but is not working anymore. My service use another service that is written from another manufacturer (this service can open communications to some hardver devices and communicate with them). It seems that on booting my service starts before that service it depends on, so it is not working (I suppose that is because on starting my service call that custom service to open communication to devices and after restart or log off I lost these opened communications to hardware devices that are controlled by that custom service). How I can set that my windows service depends on this service? (I know the path of EXE file of that custom service and this service is listed in services.msc). I see in C# initialization of windows service array ServicesToRun - so how I can reference and load that service I depend on to load before my service)? I hope that it will resolve my problem...
Within the Service Control Panel, you can set dependencies within the properties page. Window will only start your service after the dependency has started.
-
Within the Service Control Panel, you can set dependencies within the properties page. Window will only start your service after the dependency has started.