ServiceThrottlingBehavior Class

 

Configures run-time throughput settings that enable you to tune service performance.

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

System.Object
  System.ServiceModel.Description.ServiceThrottlingBehavior

public class ServiceThrottlingBehavior : IServiceBehavior

NameDescription
System_CAPS_pubmethodServiceThrottlingBehavior()

Initializes a new instance of the ServiceThrottlingBehavior class.

NameDescription
System_CAPS_pubpropertyMaxConcurrentCalls

Gets or sets a value that specifies the maximum number of messages actively processing across a ServiceHost.

System_CAPS_pubpropertyMaxConcurrentInstances

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

System_CAPS_pubpropertyMaxConcurrentSessions

Gets or sets a value that specifies the maximum number of sessions a ServiceHost object can accept at one time.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

Use the ServiceThrottlingBehavior class to control various throughput settings that help prevent your application from running out of memory.

The MaxConcurrentCalls property limits the number of messages that currently process across a ServiceHost.

The MaxConcurrentInstances property limits the number of InstanceContext objects that execute at one time across a ServiceHost.

The MaxConcurrentSessions property limits the number of sessions a ServiceHost object can accept.

Because run-time load balancing requires experience running the application, using the ServiceThrottlingBehavior through an application configuration file is the most common method of modifying execution to maximize service performance.

System_CAPS_noteNote

A trace is written every time the value of these properties is reached. The first trace is written as a warning.

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: