Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable IIS Idle Timeouts in Azure Web Role

Tags:

To prevent AppPool recycling every 20 minutes, I'd like to remove IIS AppPool Idle Timeouts when my Azure Web Role starts. My website is a Web Application Project.

How do I do this?

like image 397
Albert Bori Avatar asked Aug 06 '13 20:08

Albert Bori


People also ask

How do I increase request timeout in Azure App?

As you are aware, the 230 seconds is a timeout configured at the Azure App service load balancer. This is a part of the Azure App service architecture and cannot be configured or changed.

Why does my request time out after 230 seconds?

Note that the idle timeout is at the TCP level which means that if the connection is idle only and no data transfer happening, then this timeout is hit. --Timeout will hit if the web application got the request and kept processing the request for > 4minutes without sending any data back.


1 Answers

Create a startup task to disable the idle timeout:

  1. In the website project referenced by your web role project, add a file Startup.cmd to the root folder.

  2. In the properties for Startup.cmd, set Copy to Output Directory to Copy if newer.

  3. Add this line to Startup.cmd:

    if exist %windir%\system32\inetsrv\appcmd.exe %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00 

    The if exist %windir%\system32\inetsrv\appcmd.exe qualifier is optional. It lets you use the same code on the Azure Emulator Express, so you don't need IIS installed or need to run Visual Studio as Administrator.

  4. Save the file as UTF-8 without signature. (File > Advanced Save Options in Visual Studio.)

  5. In your web role project, in ServiceDefinition.csdef, add this to the WebRole:

    <Startup>   <Task commandLine="Startup.cmd" executionContext="elevated" /> </Startup> 
like image 90
Edward Brey Avatar answered Sep 19 '22 05:09

Edward Brey