MaxConcurrentInstances Property
Collapse the table of content
Expand the table of content

ServiceThrottlingBehavior.MaxConcurrentInstances Property

 

Gets or sets a value that specifies the maximum number of InstanceContext objects in the service that can execute at one time.

Namespace:   System.ServiceModel.Description
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 the sum of the value of MaxConcurrentSessions and the value of MaxConcurrentCalls..

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.

You can also set the values of this attribute by using the <serviceThrottling> element in an application configuration file.

The following code example shows the use of ServiceThrottlingBehavior from an application configuration file that sets the MaxConcurrentSessions, MaxConcurrentCalls and MaxConcurrentInstances properties to 1 as an example. Real-world experience determines what the optimal settings are for any particular application.

.NET Framework
Available since 3.0
Return to top
Show:
© 2016 Microsoft