Search code examples
asp.netiisiis-7iis-6hangfire

IIS 6.1 - Always running web site with Hangfire for background jobs


I want to create an ASP.NET web site on IIS 6.1 (cannot be changed), that does not recycle nor shuts down. I want it to always be running and never be down not even for a second.

Are there any built-in features that can help me achieve this?

(I cannot create a Windows Service. I need a web site.)

The workaround and less preferable solution would be creating a regular web site and creating a windows scheduled task that calls a function in that web site in a fixed interval so it never recycles.

Do you know if IIS 7.* or IIS 8 support such a functionality?

** EDIT

It will be a web site running Hangfire for the background tasks. Of course the Windows Service + Hangfire solution is better but because the lack of time and to keep it simple for our developers it is easier for us to maintain a web site which runs background jobs.


Solution

  • Depending on the framework, framework version, etc there might be different configurations that need to be accounted.

    The best approach would be to check the official docs that asses this exact problem. For example, if you build a .NET Core app, the steps for keeping an app alive are:

    • Managed pipeline mode: Integrated
    • Set start mode to “Always Running”.
    • Set Idle Time-Out (minutes) to 0.
    • Set Preload Enabled = True
    • Go to the Configuration Editor on your app, and navigate to system.webServer/applicationInitialization. Set the following settings:

    doAppInitAfterRestart: True Open up the Collection… ellipsis. On the next window, click Add and enter the following:

    • hostName: {URL host for your Hangfire application}
    • initializationPage: {path for your Hangfire dashboard, like /hangfire}