We are leaving Russia. We are against aggression and war with Ukraine. It is a tragedy for our nations, it is a nightmare

After Hangfire Server restart, Recurring Jobs don't hit the configured method anymore. Though AlwaysOn feature is configured and working

I am facing weird issue with Hangfire Recurring Jobs. My recurring Jobs stops working(i.e. don’t hit my method) after Hangfire server restarts. i.e. If I restart my web application’s app pool then Hangfire Recurring Jobs would stop working unless I open my web application/Hangfire Dashboard in browser. However, Hangfire server restarts as soon as I recycle app pool as I have checked the Hangfire database table. Though Hangfire dashboard shows that all previous Jobs ran successfully.

My Hangfire server is in IIS website. I know we need to configure AlwaysOn feature for Hangfire when it is running under IIS. I have done it already and it’s working fine as I verified by recycling the application pool and opening the Hangfire dashboard after 5 minutes, and Hangfire Server does say that it started 5 minutes ago. So, I think it’s configured correctly.

I am looking for ways to debug this issue.

Few points

  • Manually triggering the job works fine.
  • Jobs working fine if Hangfire Dashboard/Website is open in browser.
  • Jobs working fine for sometime even after Dashboard/Website is closed in browser.
  • Hangfire Dashboard shows that all recurring jobs ran successfully as per CRON schedule.

-Info

I have created my application as application under Default Web site. Does that make any difference? Though I have separate application pool for my web app. I have made changes to my web application pool only regarding AlwaysOn feature. I haven’t done anything with DefaultWebSite app pool.

Do you use .Net Core? There the problem is that if you restart the Application Pool, the site is not up again until the first request to the page. We implemented some Monitoring to avoid these issues.

Hi Gwen,

How did y’all go about implementing monitoring to deal with this?

Thanks,
Andrew

We have a separate Monitoring System which calls the HangfirePage every 15mins or so to see if its still up. Since we implemented this we don’t have the issue anymore.