【发布时间】:2017-08-04 11:16:22
【问题描述】:
我创建了一个运行在 Windows 服务中的 Quartz 服务器,该服务具有各种计划作业。
但是,我需要从 Web 应用程序 UI 中的事件手动触发一项工作。
Quartz.NET 作业:
public class IntensiveJob : IJob
{
public void Execute(IJobExecutionContext context)
{
// Get job parameters here... BUT HOW?!
// Do some intensive processing here...
}
}
我需要触发作业的操作:
public class SomeController : Controller
{
[HttPost]
public ActionResult Run()
{
// Need to be able to trigger the intensive job here...
// Ideally with some arguments too... E.g:
var job = new IntensiveJob();
job.Execute();
return RedirectToAction("Index");
}
}
任何有关实施此方法或替代方法的最佳方法的建议都会很棒。
【问题讨论】:
标签: c# asp.net-mvc quartz.net