简体   繁体   English

WindowsService.OnStop()

[英]WindowsService.OnStop()

I wrote a service in C#, and I overrode the function OnStop . 我在C#中编写了一个服务,并且我覆盖了OnStop函数。

Will this function be called when I restart the service, or only when I stop it? 当我重新启动服务时,或者仅当我停止服务时,是否会调用此函数?

Yes when you restart the service is called 是的,当您重新启动服务时调用

Stop() 

and then : 接着 :

Start()

The “OnStop” event handler “OnStop”事件处理程序

The “OnStop” event handler is being triggered when the EventLogger Service is being stopped or restarted. 当EventLogger服务被停止或重新启动时,将触发“OnStop”事件处理程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM