I use Quartz lib for executing some tasks by schedule on my ASP.NET MVC project. I initialize my Jobs into method Application_Start of Global.asax file. But after some time Quartz was stopped because method Application_End was executed.
Variables were declared as static:
public static ISchedulerFactory scheduleFactory = new StdSchedulerFactory();
public static IScheduler scheduler = scheduleFactory.GetScheduler();
Here is how Quards's Jobs were initialized:
IJobDetail jobSender = new JobDetailImpl("jobSender", "MailGroup", typeof(JobMailSender));
ITrigger triggerSender = new CronTriggerImpl("triggerSender", "SenderGroup", "jobSender", "MailGroup", "0 0/30 * * * ?");
scheduler.ScheduleJob(jobSender, triggerSender);
scheduler.Start();
I have found the reason why it happens. When all user's sessions will cease to exist and server doesn't have active user's sessions then method Application_End will execute.
I have created new Quartz's job which opens the site every 15 min and as result new user session will create on server. But still method Application_End is called from time to time.
Is anyone faced with a similar problem? Maybe web.config has some settings that would not be executed method Application_End, even if there are no active sessions on the server?