我在 Globals.asax.cs 中的 Application_Start() 中初始化 Quartz,如下所示:
// construct a scheduler factory
ISchedulerFactory schedFact = new StdSchedulerFactory();
IScheduler sched = schedFact.GetScheduler();
sched.Start();
IJobDetail dailyUserMailJob = new JobDetailImpl("DailyUserMailJob", null, typeof(DailyUserMail));
// fire every daye
ITrigger dailyUserMailTrigger = new SimpleTriggerImpl("DailyUserMailTrigger", 1,
new TimeSpan(1, 0, 0, 0));
sched.ScheduleJob(dailyUserMailJob, dailyUserMailTrigger);
作业应该每天运行一次,问题是,每次我访问我的网站时它都会运行。
有任何想法吗 ?