在vs里面注册成功了,但是时间点并没有触发执行,是在网站global.asax文件写的。代码如下:
public class ShiftNotify : IJob { public void Execute(IJobExecutionContext context) { new BLL.XXX(); } } protected void Application_Start(object sender, EventArgs e) { ISchedulerFactory factory = new StdSchedulerFactory(); _scheduler = factory.GetScheduler(); IJobDetail job = new JobDetailImpl("Job", "Default", typeof(ShiftNotify)); ITrigger trigger = new CronTriggerImpl("trigger", "Default", "*/5 * * * * ?"); _scheduler.ScheduleJob(job, trigger); _scheduler.Start(); }
这个是5秒执行一次。