Disable IIS Idle Timeouts in Azure Web Role

后端 未结 6 2029
-上瘾入骨i
-上瘾入骨i 2020-12-23 22:02

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.

6条回答
  •  粉色の甜心
    2020-12-23 22:31

    Another option is to configure IIS Idle Time-Out Action to 'Suspend'. You can do it as a part of your web role startup script.

    Command that you need is on the box as part of IIS setup (note that this will work with Windows Server 2012 R2 and up, with your code targeting .NET 4.5.1 framework and higher).

    %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeoutAction:Suspend
    

    You'll have to update your Azure Cloud Service configuration file (.cscfg) to use OS Family 4, as outlined by scottgu in his blog post.

    Since startup actions run when your instances are provisioned and before web application is deployed to IIS, by setting application pool defaults will defacto set your application apppool idel time out action to Suspend.

提交回复
热议问题