Asp.net mvc Quartz.NET在果园CMS中的应用
我正在建立一个Orchard CMS网站项目,我需要安排一些工作,这些工作的数据会反复存储在数据库中,因此我在Orchard.Web的Global.asax中使用Quartz.NET,如下所示:Asp.net mvc Quartz.NET在果园CMS中的应用,asp.net-mvc,cmd,orchardcms,scheduler,quartz.net,Asp.net Mvc,Cmd,Orchardcms,Scheduler,Quartz.net,我正在建立一个Orchard CMS网站项目,我需要安排一些工作,这些工作的数据会反复存储在数据库中,因此我在Orchard.Web的Global.asax中使用Quartz.NET,如下所示: protected void Application_Start() { RegisterRoutes(RouteTable.Routes); _starter = new Starter<IOrchardHost>(HostInitialization, HostBegin
protected void Application_Start() {
RegisterRoutes(RouteTable.Routes);
_starter = new Starter<IOrchardHost>(HostInitialization, HostBeginRequest, HostEndRequest);
_starter.OnApplicationStart(this);
ISchedulerFactory sf = new StdSchedulerFactory();
// get a scheduler
IScheduler sched = sf.GetScheduler();
sched.Start();
var job = JobBuilder.Create<JobWorker>()
.WithIdentity("job1", "group1")
.Build();
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger1", "group1")
.StartAt(DateTime.Now)
.WithCronSchedule("5 0/1 * * * ?")
.Build();
sched.ScheduleJob(job, trigger);
}
A first chance exception of type 'System.ArgumentException' occurred in Quartz.dll
A first chance exception of type 'Quartz.SchedulerException' occurred in Quartz.dll
A first chance exception of type 'Quartz.SchedulerException' occurred in Quartz.dll
The thread '<No Name>' (0x2278) has exited with code 0 (0x0).
The thread '<No Name>' (0x3368) has exited with code 0 (0x0).
The thread '<No Name>' (0x22a8) has exited with code 0 (0x0).
The thread '<No Name>' (0x2bc8) has exited with code 0 (0x0).
但是,我在调试输出控制台中收到如下结果:
protected void Application_Start() {
RegisterRoutes(RouteTable.Routes);
_starter = new Starter<IOrchardHost>(HostInitialization, HostBeginRequest, HostEndRequest);
_starter.OnApplicationStart(this);
ISchedulerFactory sf = new StdSchedulerFactory();
// get a scheduler
IScheduler sched = sf.GetScheduler();
sched.Start();
var job = JobBuilder.Create<JobWorker>()
.WithIdentity("job1", "group1")
.Build();
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger1", "group1")
.StartAt(DateTime.Now)
.WithCronSchedule("5 0/1 * * * ?")
.Build();
sched.ScheduleJob(job, trigger);
}
A first chance exception of type 'System.ArgumentException' occurred in Quartz.dll
A first chance exception of type 'Quartz.SchedulerException' occurred in Quartz.dll
A first chance exception of type 'Quartz.SchedulerException' occurred in Quartz.dll
The thread '<No Name>' (0x2278) has exited with code 0 (0x0).
The thread '<No Name>' (0x3368) has exited with code 0 (0x0).
The thread '<No Name>' (0x22a8) has exited with code 0 (0x0).
The thread '<No Name>' (0x2bc8) has exited with code 0 (0x0).
Quartz.dll中发生“System.ArgumentException”类型的首次意外异常
Quartz.dll中发生了类型为“Quartz.ScheduleException”的第一次意外异常
Quartz.dll中发生了类型为“Quartz.ScheduleException”的第一次意外异常
线程“”(0x2278)已退出,代码为0(0x0)。
线程“”(0x3368)已退出,代码为0(0x0)。
线程“”(0x22a8)已退出,代码为0(0x0)。
线程“”(0x2bc8)已退出,代码为0(0x0)。
我曾尝试在一个WebMVC4项目中使用这段代码——而不是orchard项目——但效果不错。因此,我认为问题出在果园CMS。
我该怎么办?我只需要一个计时器来反复调用SchedulerService中的ExecuteJob()方法 我不确定如何让Quartz.NET在Orchard中工作,但Orchard有自己的服务来处理重复和/或预定的后台任务
请看一下为简单的定期任务实施IBackgroundTask(),为更复杂的定时定期任务或计划的一次性任务实施isScheduledTaskHandler()。我不确定如何让Quartz.NET在Orchard中工作,但Orchard有自己的服务来处理定期和/或计划的后台任务
看看如何为简单的重复性任务实现IBackgroundTask(),为更复杂的定时重复性任务或计划的一次性任务实现isScheduledTaskHandler()。Wow,这比使用Quartz.NET:)哇,这比使用Quartz.NET:)更简单。)