Compartilhar via


<transactedBatching>

Specifies whether transaction batching is supported for receive operations.

Schema Hierarchy

<system.serviceModel>
  <behaviors>
    <endpointBehaviors>
      <behavior> of <endpointBehaviors>
        <transactedBatching>

Syntax

<transactedBatching maxBatchSize="Integer" />

Attributes and Elements

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

Attributes

Attribute Description

maxBatchSize

An integer that specifies the maximum number of receive operations that can be batched together in one transaction. The default is 0.

Child Elements

None.

Parent Elements

Element Description

<behavior> of <endpointBehaviors>

Specifies an endpoint behavior.

Remarks

A transport that is configured with transaction batching attempts to batch several receive operations into one transaction. By doing so, the relatively high cost of creating a transaction and committing it in every receive operation is avoided.

Example

The following example shows how to add the transacted batching behavior to a service in a configuration file.

<system.serviceModel>
  <services>
    <service name="Microsoft.ServiceModel.Samples.CalculatorService"
             behaviorConfiguration="CalculatorServiceBehavior">
      <host>
        <baseAddresses>
          <add baseAddress="https://localhost:8000/ServiceModelSamples/service"/>
        </baseAddresses>
      </host>

      <!-- Define NetMsmqEndpoint -->
      <endpoint address="net.msmq://localhost/private/ServiceModelSamples"
                binding="netMsmqBinding"
                contract="Microsoft.ServiceModel.Samples.IQueueCalculator" />

      <!-- the mex endpoint is explosed at https://localhost:8000/ServiceModelSamples/service/mex -->
      <endpoint address="mex"
                binding="mexHttpBinding"
                contract="IMetadataExchange" />
    </service>
  </services>

  <behaviors>
    <endpointBehaviors>
      <behavior name="endpointBehavior">
        <transactedBatching maxBatchSize="10" />
      </behavior>
    </endpointBehaviors>
    <serviceBehaviors>
      <behavior name="CalculatorServiceBehavior">
        <serviceMetadata httpGetEnabled="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>

See Also

Reference

TransactedBatchingElement
TransactedBatchingBehavior