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.
In the root of your Web Application Project, create a file named WebRole.cs with the following code:
public class WebRole : RoleEntryPoint
{
public override void Run()
{
RemoveIISTimeouts();
base.Run();
}
private void RemoveIISTimeouts()
{
Process.Start(
String.Format(@"{0}\system32\inetsrv\appcmd", Environment.GetEnvironmentVariable("windir")),
"set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00");
}
}