简体   繁体   English

OnPause/OnContinue on Worker 服务

[英]OnPause/OnContinue on Worker Service

I'm migrating a Windows Service from.Net Framework to.Net Core.我正在将 Windows 服务从.Net Framework 迁移到.Net Core。 So i'm planning to create Worker Service project and use the BackroundService class.所以我打算创建 Worker Service 项目并使用BackroundService class。

However, BackgroundService class does not have OnPause and OnContinue methods.但是, BackgroundService class 没有OnPauseOnContinue方法。

Is there a way/alternative where i can define OnPause/OnContinue for a Windows Service in.Net Core 3.1?有没有一种方法/替代方法,我可以在.Net Core 3.1 中为 Windows 服务定义OnPause/OnContinue

You can check out my question .你可以看看我的问题 Based on the accepted answer (which is also mine), you could also define your methods and invoke them when the execution interval is set to 0 ( OnPause ) or any other value ( OnContinue ).根据接受的答案(这也是我的),您还可以定义您的方法并在执行间隔设置为 0( OnPause )或任何其他值( OnContinue )时调用它们。

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

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