背景工作运行 [英] Background Job running

查看:67
本文介绍了背景工作运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai Everyone ...





我开发了一个Web应用程序,其中保存了多个程序,其中包含一个作业名称在后台以时间间隔执行。实际上,我可以获得所有作业的时间,但是在分配给特定作业的程序序列中只执行一个程序。我需要按顺序执行所有该作业中的程序,如果特定程序中的任何错误,我需要向用户显示在程序中哪个特定行有错误应该在后台运行。不应该在客户端浏览中受到干扰。所以请有人建议我一个想法。

Hai Everyone...


I had developed a web application in which saving multiple programs with one job name that to be executed at a schedule interval of time in the background.Actually i can able to get the times of all the jobs but only one programm is being executed in the sequence of programs which are assigned to a particular job.I need to execute sequentially all the programs in that job and if any error in the particular programm i need to show the user that in which particular line its having error in the programm.everything should be run in background .it should not get disturbed in the client-side browsing.so please can anyone suggest me an idea.

推荐答案

Windows服务!应该做你想要的。



示例:发送自动电子邮件提醒的简单Windows服务 [ ^ ]



有关Windows服务的详细信息:MSDN:Windows服务应用程序简介 [ ^ ]



有关详细信息,请查看此处:

简单Windows服务示例 [ ^ ]

您的第一个C#Web服务 [ ^ ]

Windows Services in Action I [ ^ ]
Windows Service! should do what you seek.

Sample: Simple Windows Service which sends auto Email alerts[^]

Details about Windows Service: MSDN: Introduction to Windows Service Applications[^]

For more details, look here:
Simple Windows Service Sample[^]
Your first C# Web Service[^]
Windows Services in Action I[^]


解决方案1建议您开发Windows服务。这是正确的,全面的方法。但是,正如您提到的那样,在预定的时间间隔执行某项作业,您可以考虑使用专为此目的而设计的现有服务。它已与Windows捆绑并启用;你可以在不同的层面上使用它。它被称为Window Task Scheduler,请参阅 http://en.wikipedia.org/wiki/Windows_Task_Scheduler [ ^ ]。



首先,您可以使用命令行实用程序AT.EXE或CSHTASKS.EXE(替换AT.EXE)来安排事件,请参阅:

http://en.wikipedia.org/wiki/At_%28Windows%29 [ ^ ],

http://en.wikipedia.org/wiki/Schtasks [ ^ ],

http://technet.microsoft .com / zh-cn / library / bb490866.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357%28v=vs.85%29 .aspx [ ^ ]。



您还可以使用Window Task Scheduler API,请参阅:

http://msdn.microsoft.com/en-我们/ library / windows / desktop / aa383614%28v = vs.85%29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/windows/desktop/aa383608%28v= vs.85%29.aspx [ ^ ] 。



要了解如何在.NET中使用它,请参阅此CodeProject文章:用于.NET的新任务计划程序类库 [ ^ ]。



-SA
Solution 1 recommends you to develop a Windows Service. This is right, comprehensive approach. However, as you mentioned about performing of some job at scheduled time interval, you could consider using existing service which is designed for such purposes. It is already bundled with Windows and enabled; you can use it on different levels. It is called Window Task Scheduler, see http://en.wikipedia.org/wiki/Windows_Task_Scheduler[^].

First, you can schedule events using command-line utilities AT.EXE or CSHTASKS.EXE (which is replacing AT.EXE), see:
http://en.wikipedia.org/wiki/At_%28Windows%29[^],
http://en.wikipedia.org/wiki/Schtasks[^],
http://technet.microsoft.com/en-us/library/bb490866.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357%28v=vs.85%29.aspx[^].

And you also can use Window Task Scheduler API, please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383608%28v=vs.85%29.aspx[^].

To see how can you use it with .NET, see this CodeProject article: A New Task Scheduler Class Library for .NET[^].

—SA


这篇关于背景工作运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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