Quartz.NET scheduler doesn't fire jobs/triggers once deployed

There are nothing wrong with Quartz, all because of IIS app pool recycling. I fixed the bug by stopping the pool that is used for Quartz from recycling:
1. Go to IIS manager -> Application Pools -> Create a new pool, I named it Scheduler (u can named anything)
2. Select Scheduler pool -> advanced Settings
+ In General section, at Start Mode, Select AlwaysRunning (IIS 8.5) or true for (IIS 7.5, 8)
+ In Process Model Section-> Idle Timeout(minutes) set to 0 (meaning: No Idel timeout)
+ In Recycling section -> Regular time Interval set to 0 (meaning: no recycling)
3. Deploy your Quartz site into that application pool. And send one request to the pool to "wake your app up" and it will run until u stop it. enter image description here
That's it.
Updated: Another solution to keep your app pool always alive is using Auto-Start ASP.NET Applications


One thing that I have noticed is the use of the Scheduler in your asp.net application.
You should use singleton objects.

in your process.aspx.cs this line

IScheduler scheduler = new StdSchedulerFactory().GetScheduler();

creates a new scheduler but you should use the one you've created as static in Application_Start.

If you want to get access to the singleton instance use a public memeber in your Global.asax.cs:

 public static ISchedulerFactory SchedulerFactory;
 public static IScheduler Scheduler;

and you can reference it in your process.aspx.cs:

MvcApplication.Scheduler.ScheduleJob(job, triggersSet, true);

Another solution is to use dependency injection. You can find some info here using StructureMap and here for Unity.

UPDATE:

You can download a sample application (asp.net 4.0) called AspNet_Quartz here and see how it works here.


The problem is related to IIS rather than the schedulers Quartz.NET, Hangfire, etc. On the other hand, there are lots of solution methods posted on the web, but only some of them is working. In my opinion, there is no need to apply lots of configuration settings. Just install Keep Alive Service For IIS 6.0/7.5 on the server to which you publish your application and enjoy. After that, your published application will be alive after application pool recycling, IIS/Application restarting, etc. Hope this helps...