Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable pool recycling on Azure Websites

I have a website deployed on Azure Websites and I want to disable pool recycling.

If you have a regular IIS installation, you can disable this in application pool advanced settings by setting "Recycling -> Disable overlapped recycle" to true.

Yet I can't seem to find this option in the azure management console, nor do I find any information on this subject online.

Any pointers would be greatly appreciated!

like image 386
ldx Avatar asked Dec 11 '14 10:12

ldx


2 Answers

Thanks a lot Puneet Gupta for pointing me in the right direction! I couldn't use the exact solution, but it set me on the right path.

Here's how I solved this:

1) Get your hands on the applicationHost.config. The easiest way is going through the SCM Console via "files" and then follow the links in json. In the end, you end up here: https://YOUR_WEBSITE_NAME.scm.azurewebsites.net/api/vfs/LocalSiteRoot/Config/applicationhost.config

2) Identify the current status of overlapped recycle. In the applicationHost.config file, look for the "applicationPools" element It should look like this:

<applicationPools>
  <add name="YOUR_SITE_NAME" managedRuntimeVersion="v4.0">
    <processModel identityType="ApplicationPoolIdentity" />
  </add>
  <add name="~1YOUR_SITE_NAME" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated">
    <processModel identityType="ApplicationPoolIdentity" />
  </add>
</applicationPools>

If you see this, then overlapped recycle is ENABLED! You can't write directly to this file but fortunately microsoft gives us the power to transform it!

3) Transform it! You can transform the applicationHost.config file by placing an applicationHost.xdt file in the /site directory of your website (mind you that the website itself is deployed in the /site/wwwroot directory, so your applicationHost.xdt transform must reside in the parent folder of where your website is. If you want to disable overlapped recycle, then this is what you put in the file:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">>
  <system.applicationHost>
    <applicationPools>
      <add name="YOUR_SITE_NAME" xdt:Locator="Match(name)">
        <recycling disallowOverlappingRotation="true" xdt:Transform="Insert" />
      </add>
      <add name="~1YOUR_SITE_NAMEd" xdt:Locator="Match(name)">
        <recycling disallowOverlappingRotation="true" xdt:Transform="Insert" />
      </add>
    </applicationPools>
  </system.applicationHost>
</configuration>

4) restart the site finally you need to restart your site to have your transformations applied. After restart, go to step 1 again and you should now see this instead:

<applicationPools>
  <add name="YOUR_SITE_NAME" managedRuntimeVersion="v4.0">
    <processModel identityType="ApplicationPoolIdentity" />
    <recycling disallowOverlappingRotation="true" />
  </add>
  <add name="~1YOUR_SITE_NAME" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated">
    <processModel identityType="ApplicationPoolIdentity" />
    <recycling disallowOverlappingRotation="true" />
  </add>
</applicationPools>

et voila: overlapped recycle is now disabled on your azure website.

like image 199
ldx Avatar answered Sep 22 '22 01:09

ldx


You will have to use a XDT transform similar to the one mentioned in https://github.com/projectkudu/kudu/wiki/Xdt-transform-samples#remove-all-your-recycling-options-from-your-net-4-application-pool-and-make-it-available-always.

More details on using transforms is in http://blogs.msdn.com/b/waws/archive/2014/06/17/transform-your-microsoft-azure-web-site.aspx

like image 24
Puneet Gupta Avatar answered Sep 22 '22 01:09

Puneet Gupta