.NET Windows Services stopping order when the system shutdown

让人想犯罪 __ 提交于 2019-12-24 12:51:15

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/33211525/net-windows-services-stopping-order-when-the-system-shutdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!