Blog Stats
  • Posts - 25
  • Articles - 0
  • Comments - 14
  • Trackbacks - 36

 

Setting Dependancies between Services in Windows

I am currently creating a set of Windows Services in C#, that need to be loaded in order, for example, Service A needs to be running before Service B.  I notice that in the .Net framework there is a distinct lack of provision for achieving this in C#.  I see that I can use Interop and call the Win32 function, ChangeServiceConfig, but I have not found an example written in C# that allows me to set the Dependancies.

Has anyone got a code snippet / example that I can use, otherwise I have to write this myself, and I hate having to write this type of plumbing logic

Thanks

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Feedback

# re: Setting Dependancies between Services in Windows

Gravatar D-

I haven't actually written a service with dependencies, but supposedly that's accomplished by creating an installer and assigning an array of service names to the ServiceInstaller.ServicesDependedOn property.

You might be able to do this with WMI (System.Management), also. I know you can change start mode with WMI.

Joe 3/24/2005 10:37 PM | joe levasseur

# re: Setting Dependancies between Services in Windows

Gravatar I used the ServicesDependedOn and it works great, Thanks for the pointer 3/31/2005 7:47 PM | DLG

# re: Setting Dependancies between Services in Windows

Gravatar My service depends on MS SQL server and and MS CA. Could any one tell me the service names I can use to set ServicesDependedOn prpperties. Thanks!
6/27/2005 5:58 PM | pyang

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

 

 

Copyright © David Lattimore-Gay