Export (0) Print
Expand All

ConnectionTimeout Property

IIS 7.0

Gets or sets the period of time that IIS 7 waits before it considers a connection inactive and terminates it.

Namespace:  Microsoft.Web.Administration
Assembly:  Microsoft.Web.Administration (in Microsoft.Web.Administration.dll)

public TimeSpan ConnectionTimeout { get; set; }

Property Value

Type: System..::..TimeSpan
A System..::..TimeSpan object that specifies the period of time that IIS 7 waits before it considers a connection inactive and terminates it. The default is 2 minutes.

You can see and modify the ConnectionTimeout property in the Advanced Settings dialog box in IIS Manager.

When you set the ConnectionTimeout property, you need to call the ServerManager..::..CommitChanges method to persist the change to the ApplicationHost.config file.

The following example checks the value of the ConnectionTimeout property. If the property value is greater than 300 seconds, the example resets ConnectionTimeout to 2 minutes. This code example is part of a larger example provided for the SiteLimits class.

// Check the connection timeout. If > 300 seconds reset to 2 minutes.
if (site.Limits.ConnectionTimeout > TimeSpan.FromSeconds(300))
{
    site.Limits.ConnectionTimeout = TimeSpan.FromMinutes(2);
    dirty = true;
} 


Community Additions

ADD
Show:
© 2014 Microsoft