Quartz.Net在30分钟后停止

时间:2018-08-14 23:14:59

标签: asp.net quartz.net quartz

我在项目中使用Quartz.NET。触发器运行15秒,但在30分钟后停止。当我尝试使用IIS在服务器上进行本地操作时,我也遇到了同样的问题。 我找不到解决问题的方法。等待帮助 对不起,英语不好。

 protected void btnDependecy_Click(object sender, EventArgs e)
    {
      JobScheduler.Start().GetAwaiter().GetResult();
    }

public class JobScheduler
{
    public static async Task Start()
    {
        try
        {
            NameValueCollection props = new NameValueCollection
            {
                { "quartz.serializer.type", "binary" }
            };

            StdSchedulerFactory factory = new StdSchedulerFactory(props);

            IScheduler sched = await factory.GetScheduler();
            await sched.Start();

            IJobDetail job = JobBuilder.Create<JobClass>()
                .WithIdentity("myJob", "group1")
                .Build();

            ITrigger trigger = TriggerBuilder.Create()
              .WithIdentity("myTrigger", "group1")
              .StartNow()
              .WithSimpleSchedule(x => x
                  .WithIntervalInSeconds(15)
                  .RepeatForever())
              .Build();

            await sched.ScheduleJob(job, trigger);
        }
        catch (SchedulerException se)
        {

        }
    }

}



     public class JobClass : IJob
        {
            public async Task Execute(IJobExecutionContext context)
            {
                await Task.Run(() =>
                {
                    olaylar();
                });
            }

            void olaylar()
            {
                Notification Send
            }
        }   

0 个答案:

没有答案