asp.net – How to disable the application pool idle time-out in IIS7?

The Question :

148 people think this question is useful

Will it be disabled if I set the idle time-out to 0?

The Question Comments :

The Answer 1

185 people think this answer is useful

Yes, setting the idle timeout value to zero will disable idle timeouts.

Oddly this isn’t documented in the MS docs but my evidence for this arises from:

  • IIS Settings Schema

    If you have a look at the IIS settings schema in:

    C:\Windows\System32\inetsrv\config\schema\IIS_schema.xml

    The schema definition for idleTimeout under

    <sectionSchema name="system.applicationHost/applicationPools">

    it looks like:

    <attribute name="idleTimeout" 
           type="timeSpan" 
           defaultValue="00:20:00" 
           validationType="timeSpanRange" 
           validationParameter="0,2592000,60"/>
    
    

    If you look at the validationParameter attribute we see a range of 0 to 2592000 seconds (the ,60 specifies the granularity of the setting, in this case the value must be divisable by 60 [one minute]).

    If you see a starting permissible value of 0 then that usually indicates the setting can be disabled.

  • IIS7 Application Pool Idle Time-out Settings

    Brad Kingsley is the founder and CEO of OrcsWeb who are a fairly well known, respected and trusted Microsoft hoster and Gold Partner.

  • Then there’s also the empirical evidence of the fact that it “just works”.

The Answer 2

11 people think this answer is useful

Great answer! thanks Kev!

A small update: the URL you posted has moved and it is now: http://bradkingsley.com/iis7-application-pool-idle-time-out-settings/

I was wondering if there is a reason why this is not the default, and if there might be a performance impact for keeping the application pool open for too long. Well, keeping it up when it is idle will not cause you more trouble than not recycling it when there is traffic and no idle time. If you are worried about memory leaks or other resource leaks, there is a setting for forcing recycling based on time/number of requests since last recycle/memory consumption. Here is the documentation for it:

http://technet.microsoft.com/en-us/library/cc753179(v=ws.10).aspx

I am going to set my server to no recycle on idle (idleTimeout=0), and recycle every 24 hours: Recycling > Regular Time Interval = 1440

The Answer 3

1 people think this answer is useful
Import-Module WebAdministration

$pools = Get-ChildItem iis:\apppools

foreach ($pool in $pools)
{ 
$poolname = $pool.Name

Set-ItemProperty IIS:\AppPools\$poolname -name processModel -value @{idletimeout="20"}
Set-ItemProperty IIS:\AppPools\$poolname -name processModel -value @{idletimeoutaction="Suspend"}
set-ItemProperty IIS:\AppPools\$poolname -Name Recycling.periodicRestart -Value @{time="0"} 
set-ItemProperty IIS:\AppPools\$poolname -Name Recycling.periodicRestart.schedule -Value @{value="02:00:00"} 
Set-ItemProperty IIS:\AppPools\$poolname -name Recycling -value @{logEventOnRecycle="Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory"} 

Write-Host "Updated $poolname settings" 
}

Add a Comment