IIS 7.0 : Managing Web Sites - Administrative Tasks - Limiting Web Site Usage, Configuring Web Site Logging and Failed Request Tracing

7/17/2012 2:55:43 PM

Limiting Web Site Usage

As in earlier versions of IIS, you can configure Web site limits such as the maximum bandwidth usage, the concurrent connection limit, and the connection time-out. You can use these limits to constrain the usage of each Web site or to enable some Web sites to handle more concurrent connections and/or use more bandwidth than others. You can set three limits:

  • Bandwidth usage (maxBandwidth)

  • Connection (maxConnections)

  • Connection time-out (connectionTimeout)

The bandwidth limit controls the network bandwidth usage to the Web site at any given time. The HTTP.sys kernel driver dynamically performs bandwidth throttling. In IIS 6.0, the throttling value is in kilobytes per second (Kbps) format. In IIS 7.0, it’s in bytes per second format with a minimum value of 1024 bytes per second. When throttling is enabled, HTTP.sys sticks to the configured limit and will insure that the site’s bandwidth usage will not exceed the specified bandwidth limit at any given time.


IIS does not guarantee precise bandwidth allocation between connections or specific requests to the Web site, only that the total bandwidth usage does not exceed the configured limit.

The connection limit specifies the maximum number of permitted connections for a particular Web site. By limiting connections to Web sites, you can effectively allocate system resources. For example, you might limit the connections for a low-priority Web site so that the system has more connections or resources available for high-priority or busy Web sites. When IIS hits the connection limits configured for a Web site, it sends back the HTTP 503 Service Unavailable error message to the client browser and writes a ConnLimit entry to the HTTP error log (httperr*.log at %windir%\system32\logfiles\httperr\).

The connection time-out specifies the connection idle time after which IIS disconnects an inactive user’s connection. By closing free, idle, or invalid connections, IIS makes more connections and ports available to valid user connections. By default, the connection time-out is set at 120 seconds.

You can set all three limits from a single dialog box in IIS Manager. To use IIS Manager to limit the number of connections and bandwidth for a particular Web site, expand the IIS computer node in the Connections pane, navigate to the Sites node, and expand the tree view. In the Sites tree listing, select the Web site that you want to change and then click on the Limits link in the Actions pane. The result is shown in Figure 3.

Limiting Web site usage through IIS Manager.

Figure 3. Limiting Web site usage through IIS Manager.

Use the following Appcmd command to show or configure a Web site’s connection limits and bandwidth throttling.

appcmd set site SiteName /limits.connectionTimeout: integer
    /limits.maxBandwidth: integer /limits.maxConnections: integer

Table 3 describes the parameters for this command.

Table 3. Syntax for Appcmd to Set Connection Limits and Bandwidth Throttling




The string represents the Web site’s friendly name.


The string specifies the HTTP connection time-out value in time span format (hh:mm:ss). For example, 00:02:00 is the default value of two minutes.


The string specifies the throttle Web site’s bandwidth in number of bytes. The value must be an integer between 1024 and 214783647.


The string specifies the maximum number of connections to the Web site. The value must be an integer between 0 and 4294967295.

Because a Web site’s limit settings belong to a <site> element, you cannot use Appcmd to list specific element values. Rather, you must list the Web site’s <site> element in detail and examine the value using the /config switch. The following command queries the Fabrikam HR Web site details.

appcmd list site /"Fabrikam HR" /config

In the output, notice that the Web site connection limits and bandwidth throttling are defined in the <limits> element within the <site> element. The following syntax limits the Fabrikam HR Web site to support a maximum connection of 500 and throttles the Web site bandwidth at 10 MB.

appcmd set site "Fabrikam HR" /limits.maxBandwidth:10485760

The following shows the <limits> element with the maxBandwidth and maxConnections attributes configured using the previous syntax.

    <site name="Fabrikam HR" id="9">
        <application path="/">
            <virtualDirectory path="/" physicalPath="d:\fabrikamHR" />
            <binding protocol="http"
                bindingInformation="*" />
            <binding protocol="http"
                bindingInformation="*" />
        <limits maxBandwidth="10485760" maxConnections="500" />

Configuring Web Site Logging and Failed Request Tracing

After the Web site is created, you can also configure how requests to this Web site are logged, including selecting the log format, the location of the log files, and the schedule for creating log files. You can access the logging setting by selecting the Web site in the tree view and selecting the Logging feature icon in the main feature panel. 

In addition, to assist with troubleshooting activities, you can enable Failed Request Tracing so that detailed request execution logs will be generated for failed requests. You can access the Failed Request Tracing (FRT) settings from the IIS Manager by selecting the Web site in the tree view and clicking Failed Request Tracing. In the resulting dialog box, you can enable Failed Request Tracing and set the location and maximum number of trace files that can be generated for the Web site.

Starting and Stopping Web Sites

By default, when a Web site is created, it is configured to automatically begin listening to requests whenever the IIS World Wide Web Publishing Service (W3SVC) is started. When a Web site is actively listening to requests, it is considered to be started.

You can stop the Web site to temporarily prevent it from accepting new requests. Stopping a Web site does not terminate any currently executing requests or affect any currently active IIS worker processes and applications belonging to the site. 

Stopping a Web site is a temporary action, which is undone whenever the W3SVC service restarts. If you want to prevent the Web site from starting automatically, you can configure it to not start automatically.

You can see the current state of each Web site when you view the Web site list in IIS Manager. You can start and stop any Web site in the list by right-clicking the Web site (in the tree view or on the Web sites list), expanding the Manage Web Site menu, and choosing Start or Stop.


When using IIS Manager to start a Web site, IIS Manager will also mark the Web site to start automatically when IIS is starting up. The Appcmd.exe command line tool will not do this, so you have the flexibility of setting the automatic start state yourself.

You can also start and stop Web sites by using the Appcmd.exe command line tool. To list the state of the Web sites on the server, you can use the following syntax.

appcmd list sites

The resulting list of sites indicates the state of each Web site as started or stopped.

SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Started)

You can optionally use the /state parameter with values of "started" or "stopped" to display only the started or stopped Web sites.

To start a stopped Web site, you can use the following syntax.

appcmd start site SiteName

To stop a started Web site, you can use the following command.

appcmd stop site SiteName

In both cases, SiteName is the name of the site to start or stop.

As noted earlier, starting or stopping the Web site with AppCmd will not automatically change whether it will automatically start when the IIS core service is starting up or shutting down. To change this, you can set the serverAutoStart configuration property on the Web site. For example, you can mark the "Default Web Site" to not start automatically as follows.

appcmd set site "Default Web Site" /serverAutoStart:false

You can use both the Start Site and Stop Site commands and the Set Site command to effectively stop and start the Web site in a way that persists across W3SVC restarts.

Video tutorials
- How To Install Windows 8

- How To Install Windows Server 2012

- How To Install Windows Server 2012 On VirtualBox

- How To Disable Windows 8 Metro UI

- How To Install Windows Store Apps From Windows 8 Classic Desktop

- How To Disable Windows Update in Windows 8

- How To Disable Windows 8 Metro UI

- How To Add Widgets To Windows 8 Lock Screen

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010
programming4us programming4us