Partilhar via


<mtomMessageEncoding>

Specifies the encoding and message versioning used for SOAP Message Transmission Optimization Mechanism (MTOM) based messages.

Schema Hierarchy

<system.serviceModel>
  <bindings>
    <customBinding>
      <binding>
        <mtomMessageEncoding>

Syntax

<mtomMessageEncoding 
   maxBufferSize="Integer"
      maxReadPoolSize="Integer"
   maxWritePoolSize="Integer"
   messageVersion="Soap11Addressing1/Soap12Addressing10"
      writeEncoding=”UnicodeFffeTextEncoding/Utf16TextEncoding/Utf8TextEncoding" />

Attributes and Elements

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

Attributes

Attribute Description

maxBufferSize

An integer that specifies the maximum size of the buffer that can be used.

maxReadPoolSize

An integer that specifies how many messages can be read simultaneously without allocating new readers. Larger pool sizes make the system more tolerant to activity spikes at the cost of a larger working set. The default is 64.

maxWritePoolSize

An integer that specifies how many messages can be sent simultaneously without allocating new writers. Larger pool sizes make the system more tolerant to activity spikes at the cost of a larger working set. The default is 16.

messageVersion

Specifies the SOAP version of the messages sent using the binding. Valid values are

  • Soap11Addressing1

  • Soap12Addressing10

The default is Soap12Addressing10. This attribute is of type MessageVersion.

writeEncoding

Specifies the character set encoding to be used for emitting messages on the binding. Valid values are

  • UnicodeFffeTextEncoding: Unicode BigEndian encoding

  • Utf16TextEncoding: Unicode encoding

  • Utf8TextEncoding: 8-bit encoding

The default is Utf8TextEncoding. This attribute is of type Encoding.

Child Elements

Element Description

<readerQuotas>

Defines the constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding. This element is of type XmlDictionaryReaderQuotasElement.

Parent Elements

Element Description

<binding>

Defines all binding capabilities of the custom binding.

Remarks

Encoding is the process of transforming a message into a sequence of bytes. Decoding is the reverse process. Windows Communication Foundation (WCF) includes three types of encoding for SOAP messages: Text, Binary and Message Transmission Optimization Mechanism (MTOM).

The MtomMessageEncoding element specifies the character encoding and message versioning and other settings used for messages using a Message Transmission Optimization Mechanism (MTOM) encoding. MTOM is an efficient technology for transmitting binary data in WCF messages. The MTOM encoder attempts to create a balance between efficiency and interoperability. The MTOM encoding transmits most XML in textual form, but optimizes large blocks of binary data by transmitting them as-is, without conversion to their base64 encoded format.

Example

<mtomMessageEncoding maxReadPoolSize="211"
    maxWritePoolSize="2132"
    messageVersion=”Soap11Addressing10”
    textEncoding=”utf-8” />

See Also

Reference

<customBinding>
MtomMessageEncodingElement
CustomBinding
MessageEncodingBindingElement
MtomMessageEncodingBindingElement

Concepts

Message Encoding

Other Resources

Choosing a Message Encoder
Windows Communication Foundation Bindings
Extending Bindings
Custom Bindings