Heba Gomaah
Heba Gomaah

Reputation: 1225

.NET Windows Services stopping order when the system shutdown

I'm creating a windows service that is supposed to send a request to a RESTFull service that is located on the same machine when the system shutdown. I want to make sure that my service OnStop() event will fire before the IIS service is stopped. Is there a way that I can control the order of services closure?

Upvotes: 1

Views: 875

Answers (1)

Marged
Marged

Reputation: 10973

Microsoft documents this:

To set the shutdown order of services manually, create a multistring registry value that contains the service names in the order in which they should be shut down and assign it to the Control key's PreshutdownOrder value, as follows

There is little information about this on a sister site of stack exchange, so I provide the link instead of copying the content: https://serverfault.com/questions/34427/windows-service-dependencies

Upvotes: 3

Related Questions