class Program { static void Main(string[] args) { StartJob(); Console.ReadKey(); } static void StartJob() { IScheduler sched = new StdSchedulerFactory().GetScheduler(); JobDetailImpl job = new JobDetailImpl("jdBossReport", typeof(Job)); IMutableTrigger triggerReport = CronScheduleBuilder.DailyAtHourAndMinute(21, 28).Build(); // 每天 23:45 执行一次 triggerReport.Key = new TriggerKey("triggerReport"); sched.ScheduleJob(job, triggerReport); sched.Start(); } } class Job : IJob { public void Execute(IJobExecutionContext context) { Console.WriteLine("任务执行成功,{0}", DateTime.Now); } }