如何创建每2小时执行一次应用程序的Windows服务 [英] How to create windows service that executes application on every 2hours

查看:144
本文介绍了如何创建每2小时执行一次应用程序的Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个应用程序,它在执行时会发送电子邮件,而我正在尝试执行
为此,我每2小时就有一个应用程序,我已经在Windows7中手动创建了一个TaskScheduler,但与其手动创建它,我还需要创建一个每2小时发送一次电子邮件的Windows服务,请提供示例代码或提出一些建议以实现此目的.

谢谢与问候,
Raghu.

解决方案


仔细阅读本文,它会逐步指导您
http://devblog.grinn.net/2008/01/windows- services-in-c-part-1.html [ ^ ]
http://devblog.grinn.net/2008/02/Windows-services-in-c-part-2-adding.html [ http://devblog.grinn.net/2008/02/Windows-services-in-c-part-3-getting.html [ http://www.intstrings.com/ramivemula/articles/sending-automated-emails-asynchronously-using-ac-windows-service-in-conjunction-with-database-email-records-part-ii/ [ http://www. dotnetfunda.com/articles/article931-how-to-send-mail-automatically-for-every-five-minutes-using-csharp.aspx [ ^ ]

Hi,
I have an application that sends email when it gets execute and i am trying to execute
the application on every 2hours for this i have manually created a TaskScheduler in windows7 but instead of manually creating it i need to create a windows service that send email on every 2hours please give sample code or give some suggestion how to implement this.

Thanks&Regards,
Raghu.

解决方案

Hi ,
Check this article it''s walk-through step by step it will guide you
http://devblog.grinn.net/2008/01/windows-services-in-c-part-1.html[^]
http://devblog.grinn.net/2008/02/windows-services-in-c-part-2-adding.html[^]
http://devblog.grinn.net/2008/02/windows-services-in-c-part-3-getting.html[^]
Best Regards
M.Mitwalli


Well, I still like the idea of Windows Schedular to run the app every two hours and do the job.

Look at the following articles to get a headstart for Windows Service approach:

http://www.intstrings.com/ramivemula/articles/sending-automated-emails-asynchronously-using-a-c-windows-service-in-conjunction-with-database-email-records-part-ii/[^]

http://www.dotnetfunda.com/articles/article931-how-to-send-mail-automatically-for-every-five-minutes-using-csharp.aspx[^]


这篇关于如何创建每2小时执行一次应用程序的Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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