Default Limits for Web Sites <limits>


The <limits> element of the <siteDefaults> element configures default settings that limit the amount of bandwidth, the number of connections, or the connection time-out for client requests for a Web server.

Note: If the <limits> element is configured in both the <siteDefaults> section and in the <site> section for a specific site, the configuration in the <site> section is used for that site.


Version Notes
IIS 7.5 The <limits> element was not modified in IIS 7.5.
IIS 7.0 The <limits> element of the <siteDefaults> element was introduced in IIS 7.0.
IIS 6.0 The <limits> element replaces the following IIS 6.0 metabase settings:
  • ConnectionTimeout
  • MaxBandwidth
  • MaxConnections


The <limits> element of the <siteDefaults> element is included in the default installation of IIS 7.

How To

How to configure the default connection limit options for a server

  1. Open Internet Information Services (IIS) Manager:
    • If you are using Windows Server 2008 or Windows Server 2008 R2:
      • On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows Vista or Windows 7:
      • On the taskbar, click Start, and then click Control Panel.
      • Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
  2. In the Connections pane, and then click the Sites node.
  3. In the Sites pane, click Set Web Site Defaults... in the Actions pane.
  4. In the Web Site Defaults dialog box, expand Connection Limits, specify connection limit options, and then click OK.



Attribute Description
connectionTimeout Optional timeSpan attribute.

Specifies the time (in seconds) that IIS waits before it disconnects a connection that is considered inactive. Connections can be considered inactive for the following reasons:
  • The HTTP.sys Timer_ConnectionIdle timer expired. The connection expired and remains idle.
  • The HTTP.sys Timer_EntityBody timer expired. The connection expired before the request entity body arrived. When it is clear that a request has an entity body, the HTTP API turns on the Timer_EntityBody timer. Initially, the limit of this timer is set to the connectionTimeout value. Each time another data indication is received on this request, the HTTP API resets the timer to give the connection more minutes as specified in the connectionTimeout attribute.
  • The HTTP.sys Timer_AppPool timer expired. The connection expired because a request waited too long in an application pool queue for a server application to dequeue and process it. This time-out duration is connectionTimeout.

The default value is 00:02:00 (two minutes).

maxBandwidth Optional uint attribute.

Specifies the maximum network bandwidth, in bytes per second, that is used for a site. Use this setting to help prevent overloading the network with IIS activity.

The default value is 4294967295.
maxConnections Optional uint attribute.

Specifies the maximum number of connections for a site. Use this setting to limit the number of simultaneous client connections.

The default value is 4294967295.

Child Elements


Configuration Sample

The following configuration sample specifies the default limits options for IIS 7.

         <limits connectionTimeout="00:03:00" />

Sample Code

The following code samples configure the default limits options for IIS 7 with a connectionTimeout of 3 minutes.


appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.limits.connectionTimeout:"00:03:00" /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.


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 sitesSection = config.GetSection("system.applicationHost/sites");
         ConfigurationElement siteDefaultsElement = sitesSection.GetChildElement("siteDefaults");

         ConfigurationElement limitsElement = siteDefaultsElement.GetChildElement("limits");
         limitsElement["connectionTimeout"] = TimeSpan.Parse("00:03:00");



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 sitesSection As ConfigurationSection = config.GetSection("system.applicationHost/sites")
      Dim siteDefaultsElement As ConfigurationElement = sitesSection.GetChildElement("siteDefaults")

      Dim limitsElement As ConfigurationElement = siteDefaultsElement.GetChildElement("limits")
      limitsElement("connectionTimeout") = TimeSpan.Parse("00:03:00")

   End Sub

End Module


var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
var siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults");

var limitsElement = siteDefaultsElement.ChildElements.Item("limits");
limitsElement.Properties.Item("connectionTimeout").Value = "00:03:00";



Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST")
Set siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults")

Set limitsElement = siteDefaultsElement.ChildElements.Item("limits")
limitsElement.Properties.Item("connectionTimeout").Value = "00:03:00"

Deprecated Elements