Uncategorized

Disable recycling in IIS 7? Use AppCmd

I stumbled on this while trying to repro a remote debug problem for a customer: as you might know from this post from Johan, debugging ASP.NET on IIS7 needs some special care about the application pool recycling policy otherwise if you’ll not be fast enough IIS will kill your process.

Well, I was doing some tests and wanted to disable the Regular Time Interval value through the IIS Manager (default for this property is 1749 minutes, i.e. 29 hours):

regular time interval 1740
regular time interval 1740

But if you try to set the value to zero, I’ll get an error message (at least in Windows 2008 RTM).

property value is not valid
property value is not valid

Luckily we can still use AppCmd to change our config store, here it is how:

appcmd.exe set AppPool <AppPoolNameHere> /recycling.periodicRestart.time:00:00:00

And if you now go back to the UI you’ll see the change correctly reflected

regular time interval 0
regular time interval 0

Of course you can manually change your applicationHost.config file, but handle it with care and be sure you always have a backup first!

appcmd add backup <BackupNameHere>

Use the Administration Pack

It’s still a preview as of now, but it contains some really interesting new features for the IIS Manager. For example you can select the server node within the Connections left panel and under the Management section you’ll now have a new Configuration Editor feature if you don’t want to use AppCmd or edit the xml file directly:

configuration management
configuration management
configuration editor application pools
configuration editor application pools

If you select applicationPools and then enter the (Collection) box, you can change the periodicRestart.time value through the new dialog and from here you can set it to zero without error messages! ?

periodic restart time
periodic restart time

By the way, also note the small hint I highlighted: that means you can set intervals to “00:00:00”, “00:01:00”, “00:02:00” etc…, but not “00:01:30” for example; you’ll get the same from AppCmd too:

appcmd
appcmd

Carlo

Quote of the day:
If someone wants a sheep, then that means that he exists. – Antoine de Saint-Exupery

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.