How to Disable hangfire when using Azure Web Apps and deployment slots

We use Azure web apps.
We have a Staging & Production Slot
When our app is on Staging how can we disable Hangfire?

What we do is add an app settings to the web.config indicating that Hangfire initialization should not occur. In the code we check the app settings and either initialize or not. Then we create a transform to remove the setting when compiled in release mode. It works like a charm.

  • Michael
1 Like

Hi! I am using swap on my staging and production slot. I am looking to use dynamic Hangfire queue names to solve this specific problem. I was wondering if you would have a better solution to this?

I have written a small writeup for this issue:

https://ryandavie.com.au/notes/hangfire-deployment-slots