How to execute Windows service at a specified time daily

≡放荡痞女 提交于 2019-12-30 10:04:29

问题


I need to schedule windows service on daily basis at pre-defined time to run and then sleep 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.


回答1:


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




回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/2379143/how-to-execute-windows-service-at-a-specified-time-daily

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