C#中用于桌面应用程序的Windows服务 [英] Windows Services for desktop application in c#

查看:102
本文介绍了C#中用于桌面应用程序的Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个桌面软件.客户要求它将自动在每小时运行一次.我需要创建Windows服务吗?

在Advance中致谢

解决方案

您可以但也可以使用称为 Windows Task Scheduler 的现有服务,请参见:
http://en.wikipedia.org/wiki/Task_Scheduler [ http://msdn.microsoft.com/en-us/library/aa383614.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/aa384006%28v = VS.85%29.aspx [ ^ ].

有关使用Windows Task Scheduler的信息,请参见上面的最后一个链接.您可以使用 Task Scheduler Managed Wrapper 在程序中使用其API,请参见 http://taskscheduler.codeplex.com/ [^ ].

但是,如果它甚至更简单.
您可以通过Windows实用程序AT.EXE或SchTasks.EXE使用Windows Task Scheduler,请参见:
http://en.wikipedia.org/wiki/At_(Windows) [ http://technet.microsoft.com/en-us/library/bb490866.aspx [ ^ ],
http://en.wikipedia.org/wiki/Schtasks [ http://msdn.microsoft.com/zh-我们/library/windows/desktop/bb736357%28v=vs.85%29.aspx [ Windows_Task_Scheduler [ ^ ]将达到目的.


Hi All,

I have a desktop software . Client requirement it will run in every hour automatically. Do i need to create windows services ?

Thanks in Advance

解决方案

You can, but also you can use the service which already exists, called Windows Task Scheduler, see:
http://en.wikipedia.org/wiki/Task_Scheduler[^],
http://msdn.microsoft.com/en-us/library/aa383614.aspx[^],
http://msdn.microsoft.com/en-us/library/aa384006%28v=VS.85%29.aspx[^].

See the last link above for use of the Windows Task Scheduler. You can use its API in your program using Task Scheduler Managed Wrapper, see http://taskscheduler.codeplex.com/[^].

But if can be even simpler.
You can use Windows Task Scheduler using Windows utilities AT.EXE or SchTasks.EXE, see:
http://en.wikipedia.org/wiki/At_(Windows)[^],
http://technet.microsoft.com/en-us/library/bb490866.aspx[^],
http://en.wikipedia.org/wiki/Schtasks[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357%28v=vs.85%29.aspx[^].

—SA


I guess Windows_Task_Scheduler[^] will serve the purpose.


这篇关于C#中用于桌面应用程序的Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆