%systemroot%\system32\inetsrv\config\applicationHost.config
Web Limits
Overview
The
element specifies TCP/IP connection and bandwidth limits.
Every 60 seconds, a worker process checks how long it has been idle. If its current idle time is greater than the idle time-out value specified by the Windows Process Activation Service (WAS), the worker process initiates a shutdown. When you specify a nonzero value for the dynamicIdleThreshold attribute, WAS will dynamically reduce this idle time-out depending on the amount of RAM used.
The dynamicIdleThreshold attribute represents the amount of committed physical RAM. For example, if your server has 2 gigabytes (GB) of physical memory installed and you set the dynamicIdleThreshold attribute value to 200, you have committed 200 percent (4 GB) of physical RAM for use. According to the following table, when 80 percent of 4 GB, that is, 160 percent (3.2 GB) of physical RAM is allocated, WAS will start reducing the idle time-out of all worker processes by 50 percent.
The following table lists the idle time-out reductions that occur at predetermined percentages of the dynamicIdleThreshold value.
Dynamic Site Activation
Dynamic site activation helps IIS address scalability issues by enabling you to defer activation of Web sites. When the number of Web sites is greater than a limit, IIS will not activate any of the sites when the service is started. It will not create a queue and a binding for each configured site upon startup, as was previously done in IIS 8.0 and earlier. Instead, it creates a single queue that listens for requests for all sites, and has a single binding. WAS loads a list of the sites, their bindings, their applications, their application pools, and their application pool settings. When a request for a site arrives, IIS uses that list to create a queue and register a binding for the site. At that point, HTTP.sys places the request in the queue, WAS starts the worker process, and the request is processed.
With dynamic site activation, the IIS service will likely start more quickly and consume less memory. IIS should also take noticeably less time to restart because it will not need to release all of the registered queues and bindings with HTTP. Activation in this context refers to a process in which IIS registers a site with the HTTP protocol stack (HTTP.sys). This activation is not the same as creating a worker process, which only happens when a request for a site is received.
Dynamic site activation is enabled when the number of sites handled by a server is greater than a pre-set limit. By default, that limit is 100. If you do not change that value, a site will be activated dynamically on a server that hosts more than 100 sites. For 100 or fewer sites, on the other hand, all sites will be activated upon startup. You can change that limit by changing the dynamicRegistrationThreshold attribute. Note that the performance gain for a server with a lower number of sites will be smaller than with significantly more sites.
Compatibility
Setup
The
element is included in the default installation of IIS 7 and later.How To
How to configure the lower limit of dynamic site activation
- Open Internet Information Services (IIS) Manager:
- If you are using Windows Server 2012 R2:
- On the taskbar, click Server Manager, click Tools, and then click Internet Information Services (IIS) Manager.
- If you are using Windows 8.1:
- Hold down the Windows key, press the letter X, and then click Control Panel.
- Click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
- In the Connections pane, select the server, and then double-click Configuration Editor in the Management area.
- In the Configuration Editor, for the Section, expand
system.applicationHost, and then select webLimits. - Enter a value for dynamicRegistrationThreshold.
- In the Action pane, click Apply.
Configuration
Attributes
The default value is
240. |Child Elements
None.
Configuration Sample
The following configuration sample sets the connection time-out to 1 minute, the percentage of committed physical RAM to 150, the header wait time-out to 30 seconds, and the minimum allowable throughput rate to 500 bytes per second.
XML
<configuration>
<system.applicationHost>
<webLimits connectionTimeout="00:01:00"
dynamicIdleThreshold="150"
headerWaitTimeout="00:00:30"
minBytesPerSecond="500"
/>
</system.applicationHost>
</configuration>
Sample Code
The following code samples set the connection time-out to 1 minute, the percentage of committed physical RAM to 150, the header wait time-out to 30 seconds, and the minimum allowable throughput rate to 500 bytes per second.
AppCmd.exe
console
appcmd.exe set config -section:system.applicationHost/webLimits /connectionTimeout:"00:01:00" /commit:apphost
appcmd.exe set config -section:system.applicationHost/webLimits /dynamicIdleThreshold:"150" /commit:apphost
appcmd.exe set config -section:system.applicationHost/webLimits /headerWaitTimeout:"00:00:30" /commit:apphost
appcmd.exe set config -section:system.applicationHost/webLimits /minBytesPerSecond:"500" /commit:apphost
Note
You must be sure to set the commit parameter to
apphost when you use AppCmd.exe to configure these settings. This commits the configuration settings to the appropriate location section in the ApplicationHost.config file.C#
C#
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample
{
private static void Main()
{
using (ServerManager serverManager = new ServerManager())
{
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection webLimitsSection = config.GetSection("system.applicationHost/webLimits");
webLimitsSection["connectionTimeout"] = TimeSpan.Parse("00:01:00");
webLimitsSection["dynamicIdleThreshold"] = 150;
webLimitsSection["headerWaitTimeout"] = TimeSpan.Parse("00:00:30");
webLimitsSection["minBytesPerSecond"] = 500;
serverManager.CommitChanges();
}
}
}
VB.NET
VB
Imports System
Imports System.Text
Imports Microsoft.Web.Administration
Module Sample
Sub Main()
Dim serverManager As ServerManager = New ServerManager
Dim config As Configuration = serverManager.GetApplicationHostConfiguration
Dim webLimitsSection As ConfigurationSection = config.GetSection("system.applicationHost/webLimits")
webLimitsSection("connectionTimeout") = TimeSpan.Parse("00:01:00")
webLimitsSection("dynamicIdleThreshold") = 150
webLimitsSection("headerWaitTimeout") = TimeSpan.Parse("00:00:30")
webLimitsSection("minBytesPerSecond") = 500
serverManager.CommitChanges()
End Sub
End Module
JavaScript
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var webLimitsSection = adminManager.GetAdminSection("system.applicationHost/webLimits", "MACHINE/WEBROOT/APPHOST");
webLimitsSection.Properties.Item("connectionTimeout").Value = "00:01:00";
webLimitsSection.Properties.Item("dynamicIdleThreshold").Value = 150;
webLimitsSection.Properties.Item("headerWaitTimeout").Value = "00:00:30";
webLimitsSection.Properties.Item("minBytesPerSecond").Value = 500;
adminManager.CommitChanges();
VBScript
VB
Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set webLimitsSection = adminManager.GetAdminSection("system.applicationHost/webLimits", "MACHINE/WEBROOT/APPHOST")
webLimitsSection.Properties.Item("connectionTimeout").Value = "00:01:00"
webLimitsSection.Properties.Item("dynamicIdleThreshold").Value = 150
webLimitsSection.Properties.Item("headerWaitTimeout").Value = "00:00:30"
webLimitsSection.Properties.Item("minBytesPerSecond").Value = 500
adminManager.CommitChanges()




