ServiceThrottle.MaxConcurrentInstances Property

 

Gets or sets the maximum number of service objects that can execute at one time.

Namespace:   System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public int MaxConcurrentInstances { get; set; }

Property Value

Type: System.Int32

The maximum number of InstanceContext objects in the service at one time. The default is Maximum Concurrent Calls + Maximum Concurrent Sessions.

The MaxConcurrentInstances property specifies the maximum number of InstanceContext objects in the service. It is important to keep in mind the relationship between the MaxConcurrentInstances property and the InstanceContextMode property. If InstanceContextMode is PerSession the resulting value is the total number of sessions. If InstanceContextMode is PerCall, the resulting value is the number of concurrent calls. If a message arrives while the maximum number of InstanceContext objects already exist, the message is held until an InstanceContext object closes.

System_CAPS_noteNote

A trace is written every time the value of this property is exceeded. The first trace is written as a warning.

The following code example shows the typical use of the ServiceThrottle by referencing the ServiceThrottlingBehavior in an application configuration file. In this case, the values that are specified establish, at most, one message processing at one time from one connection to one InstanceContext. Real-world usage must be determined through experience.

.NET Framework
Available since 3.0
Return to top
Show: