Share via


SiteLimits.ConnectionTimeout Property

Definition

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

public:
 property TimeSpan ConnectionTimeout { TimeSpan get(); void set(TimeSpan value); };
public TimeSpan ConnectionTimeout { get; set; }
member this.ConnectionTimeout : TimeSpan with get, set
Public Property ConnectionTimeout As TimeSpan

Property Value

A 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.

Examples

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;
} 

Remarks

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 Microsoft.Web.Administration.ServerManager.CommitChanges method to persist the change to the ApplicationHost.config file.

Applies to