'How do I set up my IIS to keep my application alive?

I think my Webapplication gets shut down after a while.

It returns a new session if I haven't used the application in maybe 5 minutes. The session timeout is set to 720 minutes so that can't be the issue.

Is it maybe a setting in the Application Pool or something like that? I figure it is some sort of resource management. I use IIS 7.0



Solution 1:[1]

IIS has a feature in properties where you can stop recycle your IIS on intervals

  1. Go to your "IIS Manager"
  2. Select "Application Pool" the instance you want to manage.
  3. Select "Advanced settings" action
  4. Under "Recycling" and set "Regular Time Interval" to 0, which means the application pool does not recycle.

Solution 2:[2]

  1. Open "IIS Manager"
  2. Select "Application Pool" the instance you want to manage
  3. Select "Advanced settings"
  4. Under "(General)" and set "Start Mode" to "AlwaysRunning", which means the application pool keep the ASP.NET application run always

PS. If you want the ASP.NET application be loaded automatically, you can follow this:

  1. Open "IIS Manager"
  2. Select the application you want to manage
  3. Select "Advanced settings"
  4. Under "(General)" and set "Preload Enabled" to "true", which means the applicaton will be loaded automatically after its deployment.

For more information, please visit this:Use IIS Application Initialization for keeping ASP.NET Apps alive

Solution 3:[3]

The simplest way is to use a script to open a connection to the website and request your page. See Joel Oleson's Blog for more information.

You can use windows scheduler to run every x minutes.

This maybe Sharepoint specific but you can adapt to your requirements.

Update: Try this version: WarmUpServer.zip

Solution 4:[4]

After some research on this subject, I manage to find a good reference (Scott Forsyth's Blog) and it worked for me like a charm (IIS 10, but I belive it should work starting on IIS 7). Basically, you need to set application pool Idle Time-out to 0, otherwise, when you have 20 minutes without any traffic then the app pool will terminate.

On IIS, go to Application Pools --> right click on the poll you want to edit --> Advanced Settings. Under Proccess Model, change the Iddle Time-out property to 0.

application pool advanced settings

Solution 5:[5]

Application pools do recycle, and they do restart after achieving some limits in terms of execution time or number of requests etc, that can be set on IIS.

IIS 7 actually runs in pipeline mode so its something new which we dont know yet for sure, but all you can do to make your app alive is to set a trigger from some other machine which will connect your server in every 5 or 10 or 60 minutes and try to fetch one html page.

There can be various server monitors for http as well.

Solution 6:[6]

After failed at configuring IIS pool. I come out with this simple windows service. github code

It can save some minutes of you.

Solution 7:[7]

"Preload Enabled" to "true" will work only with anonymous authentication turned on.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mohamed Mansour
Solution 2 guogangj
Solution 3
Solution 4
Solution 5 Akash Kava
Solution 6 Chinh Phan
Solution 7 Raf