I use Quartz Scheduler in my application, and I get an exception: Trigger does not reference the given task ...
Looking at my code, I do not see where the problem is.
var schedFact = new StdSchedulerFactory(); scheduler = schedFact.GetScheduler(); IJobDetail dailyJob = JobBuilder.Create<PushElectricityPricesJob>() .WithIdentity("dailyJob", "group1") .Build(); ITrigger trigger1 = TriggerBuilder.Create() .WithIdentity("dailyJobTrigger", "group1") .StartNow() .WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(3, 0)) .ForJob("dailyJob") .Build(); scheduler.ScheduleJob(dailyJob, trigger1); IJobDetail monthlyJob = JobBuilder.Create<PushContributionsJob>() .WithIdentity("monthlyJob", "group2") .Build(); ITrigger trigger2 = TriggerBuilder.Create() .WithIdentity("monthlyJobTrigger", "group2") .StartNow() .WithSchedule(CronScheduleBuilder.MonthlyOnDayAndHourAndMinute(1, 0, 0)) .ForJob("monthlyJob") .Build(); scheduler.ScheduleJob(monthlyJob, trigger2); scheduler.Start();
I found a lot of posts like this in StackOverflow, but on each of them I could notice an error or typo made by the developer. Here I just got stuck in ignorance ..
Any idea?
source share