如何在C#中计划Windows服务? [英] How to schedule windows service in c#?
本文介绍了如何在C#中计划Windows服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I have created windows service in c#. I would like to schedule windows service manually or by coding .How can I do this.
实际上,我在找
我的服务应该每天早上9点开始,并在一段时间后停止我的服务.由于Microsoft在Windows XP中提供了计划任务",因此我们可以在其中计划任何exe.以同样的方式如何安排任何Windows服务在指定时间执行?
感谢您的帮助
问候
Rajesh
推荐答案
您可以使用net命令:
You can use the net command:
net start myservicename
net start myservicename
net stop myservicename
net stop myservicename
或者,您可以使用ServiceController类编写自己的代码.
Or, you can write your own by using the ServiceController class.
这篇关于如何在C#中计划Windows服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文