Hangfire Recurring job not running in a timely manner on IIS

2.9k views Asked by At

I have a web service on IIS that does the following:

  1. I have 2 recurring jobs that internally creates around 800 jobs. The recurring job is supposed to run at midnight.
  2. Hangrire is using MSSQL in the background.

I expected the recurring jobs to run at midnight. But when I logged into the hangfire dashboard the next day, the recurring jobs got kicked off then (and not at midnight).

I was wondering whether this issue was beacuse my request to the hangfire request after the app pool refresh attributed to this behavior.

1

There are 1 answers

1
Boris On

Have you tried this?

As it says on the Hangfire docs:

By default, Hangfire Server instance in a web application will not be started until the first user hits your site. Even more, there are some events that will bring your web application down after some time (I’m talking about Idle Timeout and different app pool recycling events). In these cases your recurring tasks and delayed jobs will not be enqueued, and enqueued jobs will not be processed.

Also, don't forget to run iisreset after you're done, since the new configs need to be loaded up by the IIS server.