public void Start()
{
ISchedulerFactory schedFact = new StdSchedulerFactory();
IScheduler sched = schedFact.GetScheduler();
sched.Start();
IJobDetail job = JobBuilder.Create<EmailJob>()
.Build();
ITrigger trigger = TriggerBuilder.Create()
.StartNow()
.WithSimpleSchedule(x => x
.WithIntervalInHours(48)
.RepeatForever())
.Build();
sched.ScheduleJob(job, trigger);
}
我在IScheduler sched = schedFact.GetScheduler();
中遇到错误
它说
“无法隐式转换类型System.Threading.tasks.task Quartz.Scheduler转换为Quartz.IScheduler“
答案 0 :(得分:2)
global
返回schedFact.GetScheduler();
,应使用以下代码获取Task
对象:
IScheduler