I have created a windows service which is set to start automatically. This service connects to the database service on startup. The issue is the database service seems to start after my service. Is there is a programmatic way to define this dependency so that my service starts after the database service has started.
I found this article http://www.boyce.us/windows/servertipcontent.asp?ID=7 which talks about adding a registry entry to do that. I would like to know if there is a C# way to do this?
Update:
Adding to the above question. Here is another scenario. The services are being installed using installshied which does not need a projectinsaller. It seems installshield looks for classes deriving from ServiceBase class and installs each service. How to add the dependency in such a scenario?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…