Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS Auto-Start not disabling Idle Timeout

I setup ASP.NET Auto-Start on my Windows Azure Web Role (I use ASP.NET 4.5 and IIS 8 on Windows Server 2012). I basically followed those instructions.

I am setting startMode="AlwaysRunning" on the application pool and preloadEnabled="true" on the website through the OnStart method of the webrole.

I used remote access and verified that those two properties are correctly set (through IIS Manager, as well as checking the applicationHost.config file).

I also added this to the web.config file:

<applicationInitialization skipManagedModules="true">
  <add initializationPage="/" />
</applicationInitialization>

This page says the Idle Timeout should be disabled when auto-start is enabled. Yet, I can see from my log that it is not, the application pool gets restarted after some inactivity. I can also see that in the event log (several times over 6 hours):

A worker process with process id of '772' serving application pool 'cf9d3284-6454-4bbf-8a8e-efd73df4ed83' was shutdown due to inactivity. Application Pool timeout configuration was set to 20 minutes. A new worker process will be started when needed.

The strange thing is that it seems a new application pool is started immediately after this is logged, even if there is no request to the website. So if I don't get a single request in one hour, the application pool is recycled and restarted 3 times (I confirmed this from the logs). Is my configuration incorrect or am I missing something?

like image 523
Flavien Avatar asked Jul 09 '13 10:07

Flavien


2 Answers

Setting the Start Mode to Always Running alone didn't work for me either but setting the Idle Timeout to 0 in the application pool's Advances settings did.

Application pool Advanced Settings

like image 87
Jerther Avatar answered Oct 19 '22 10:10

Jerther


(http://developers.de/blogs/damir_dobric/archive/2009/10/11/iis-7-5-and-always-running-web-applications.aspx)

i have struggled a lot in this issue. I did everything i could to keep my services alive in IIS but eventually got tired and had to take different approach. I created a windows service just to keep those app pool alive. One approach you can try is go to IIS config file and verify that you can see the configuration you made is reflected in that config file. Refer to the link on top. But your configuration will be reset on app pool restart whatever time you set it to go to sleep. You might need to comeup with some approach.

like image 1
Bravo11 Avatar answered Oct 19 '22 10:10

Bravo11