Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For how long does Quartz run in the background when hosted on IIS (ASP.NET)?

I have an ASP.NET website, and I am using Quartz to do some background work. The Quartz job is set to trigger every 5 minutes.

Will Quartz:

  1. Run in the background continiously after the last user has left the website?
  2. Stop at some point of time, and continue when a new user enters the website?

If the answer is #2, is there a way to have the job run all the time?

like image 710
Kenci Avatar asked Nov 27 '25 07:11

Kenci


1 Answers

At some point, after some time of inactivity, your IIS hosted application will fall in some king of 'sleep mode'. From this moment, your trigger won't launch jobs anymore, until your app get reactivated by a user trying to access to it.

Here are some solution available to you :

  • Run your job in a separated windows service. Need some refactoring job but clearly the safest solution

  • Hangfire is a another .Net background job library. Here's a link they provide to their users to fix this problem, by Making ASP.NET application always running. Note that you need to have full control of your hosting environment to achieve this.

  • You could set some service as Pingdom to to prevent your site from faling into this 'sleep mode'. However, I would not recommand this solution.

Note that the time needed before your app fall into 'sleep mode' can change from an environment to another. If in your case It need more than 5 minutes (the time between each of your jobs), this process could be enough to keep your web site up. In fact, it would act as the solution #3 (use an external service to poke your environment at a frequent rate)

like image 153
Nicolas Boisvert Avatar answered Nov 29 '25 21:11

Nicolas Boisvert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!