I am trying to make simple scheduled job in Quartz.NET 2.0
I've read about a similar problem but it didn't work out for me.
The problem is that the job gets executed only once after the StartAt trigger.
Here is my code:
public EntityMappingSvc()
{
IJobDetail job = JobBuilder.Create<EntityMappingJob>().WithIdentity("QueueJob").Build();
TriggerBuilder tb = TriggerBuilder.Create();
tb.WithIdentity("StdTrigger");
tb.WithSimpleSchedule(a => a.WithIntervalInMinutes(1));
tb.StartAt(new DateTimeOffset(new DateTime(2012, 11, 20, 10, 55, 0)));
tb.ForJob(job);
ITrigger trigger = tb.Build();
Global.sched.ScheduleJob(job, trigger);
}
protected void Application_Start(object sender, EventArgs e)
{
Global.factory = new StdSchedulerFactory();
Global.sched = Global.factory.GetScheduler();
Global.sched.Start();
GC.KeepAlive(factory);
GC.KeepAlive(sched);
}
The job is simple... but to test it i had to raise an error that is caught and handled separate and does not influence the actual job.
After it runs the job the first time, it gets blocked in
while (runnable == null && run)
{
Monitor.Wait(this, 500);
}
if (runnable != null)
{
ran = true;
runnable.Run();
}
in the Run method in SimpleThreadPool.
Any suggestions?
PS: the application is a WCF IIS hosted service.
Edited:
TriggerBuilder tb = TriggerBuilder.Create();
tb.WithIdentity("StdTrigger");
tb.WithCronSchedule("0 1 * * * ?");
tb.StartAt(new DateTimeOffset(new DateTime(2012, 11, 20, 10, 45, 0)));
tb.ForJob(job);
ICronTrigger trigger = tb.Build() as ICronTrigger;
Global.sched.ScheduleJob(job, trigger);
still not working.
same problem.