Share via


<serviceThrottling>

Specifies the throttling mechanism of a Windows Communication Foundation (WCF) service.

<system.serviceModel>

  <behaviors>

    <serviceBehaviors>

      <behavior> of <serviceBehaviors>

        <serviceThrottling>

                                    
                                    <serviceThrottling maxConcurrentCalls="Integer"
                                
                                    
                                         
                                    
                                       maxConcurrentInstances="Integer"
                                
                                    
                                         
                                    
                                       maxConcurrentSessions="Integer" />
                                

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

maxConcurrentCalls

A positive integer that specifies the number of concurrent calls to a single service instance. Calls in excess of the limit are queued. Setting this value to 0 is equivalent to setting it to Int32.MaxValue. The default is 16.

maxConcurrentInstances

A positive integer that specifies the maximum number of concurrent service instances. Requests to create additional instances are queued and complete when a slot below the limit becomes available. The default is Int32.MaxValue.

maxConcurrentSessions

A positive integer that specifies the maximum number of concurrent connections to a single service. The service will accept connections in excess of the limit, but only the channels below the limit are active (messages are read from the channel). Setting this value to 0 is equivalent to setting it to Int32.MaxValue. The default is 10.

Child Elements

None.

Parent Elements


Element Description

<behavior> of <endpointBehaviors>

Specifies a behavior element.

Remarks

Throttling controls place limits on the number of concurrent calls, instances, or sessions to prevent over-consumption of resources.

Example

The following configuration example specifies that the service limits the maximum concurrent calls to 2, and the maximum number of concurrent instances to 10. For a detailed example of running this example, see Throttling.

<behaviors> 
  <serviceBehaviors> 
    <behavior name="CalculatorServiceBehavior"> 
      <serviceDebug includeExceptionDetailInFaults="False" /> 
      <serviceMetadata httpGetEnabled="True"/> 
      <!-- Specify throttling behavior -->
      <serviceThrottling maxConcurrentCalls="2" 
           maxConcurrentInstances="10"/> 
    </behavior>
  </serviceBehaviors>
</behaviors>

Footer image

Send comments about this topic to Microsoft.
© Microsoft Corporation. All rights reserved.