开发者

How to execute Windows service at a specified time daily

开发者 https://www.devze.com 2022-12-22 01:59 出处:网络
I need to schedule windows service on daily basis at pre-defined time to run and then 开发者_如何学Csleep till the next day, How can i do that?

I need to schedule windows service on daily basis at pre-defined time to run and then 开发者_如何学Csleep till the next day, How can i do that?

Solution:

Added a timer to timeout every 30 minutes and then validate if the time of the day has reached, if yes then perform the desired function, make sure that, mark a flag once its done for the day.


You don't. You setup a scheduled task; services as (generally) for background running processes.


How might I schedule a C# Windows service to perform a task daily


You can start or stop a service using a batch file.

Full details here

Then just add a scheduled task to start or stop the batch file

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号