BinaryMessageEncodingBindingElement BinaryMessageEncodingBindingElement BinaryMessageEncodingBindingElement Class


The binding element that specifies the .NET Binary Format for XML used to encode messages.

public ref class BinaryMessageEncodingBindingElement sealed : System::ServiceModel::Channels::MessageEncodingBindingElement, System::ServiceModel::Description::IPolicyExportExtension, System::ServiceModel::Description::IWsdlExportExtension
public sealed class BinaryMessageEncodingBindingElement : System.ServiceModel.Channels.MessageEncodingBindingElement, System.ServiceModel.Description.IPolicyExportExtension, System.ServiceModel.Description.IWsdlExportExtension
Public NotInheritable Class BinaryMessageEncodingBindingElement
Inherits MessageEncodingBindingElement
Implements IPolicyExportExtension, IWsdlExportExtension


BinaryMessageEncodingBindingElement be = new BinaryMessageEncodingBindingElement();
be.MaxReadPoolSize = 16;
be.MaxSessionSize = 2048;
be.MaxWritePoolSize = 16;
be.MessageVersion = MessageVersion.Default;
XmlDictionaryReaderQuotas quotas = be.ReaderQuotas;

CustomBinding binding = new CustomBinding();
BindingParameterCollection bpCol = new BindingParameterCollection();
BindingContext context = new BindingContext(binding, bpCol);

CustomBinding binding2 = new CustomBinding();
BindingParameterCollection bpCol2 = new BindingParameterCollection();
BindingContext context2 = new BindingContext(binding2, bpCol2);

BindingElement bindingElement = be.Clone();
MessageEncoderFactory mef = be.CreateMessageEncoderFactory();
MessageVersion mv = be.GetProperty<MessageVersion>(context);
Dim be As New BinaryMessageEncodingBindingElement()
be.MaxReadPoolSize = 16
be.MaxSessionSize = 2048
be.MaxWritePoolSize = 16
be.MessageVersion = MessageVersion.Default
Dim quotas As XmlDictionaryReaderQuotas = be.ReaderQuotas

Dim binding As New CustomBinding()
Dim bpCol As New BindingParameterCollection()
Dim context As New BindingContext(binding, bpCol)
be.BuildChannelFactory(Of IDuplexChannel)(context)

Dim binding2 As New CustomBinding()
Dim bpCol2 As New BindingParameterCollection()
Dim context2 As New BindingContext(binding2, bpCol2)
be.BuildChannelListener(Of IDuplexChannel)(context2)

be.CanBuildChannelListener(Of IDuplexChannel)(context2)
Dim bindingElement As BindingElement = be.Clone()
Dim mef As MessageEncoderFactory = be.CreateMessageEncoderFactory()
Dim mv As MessageVersion = be.GetProperty(Of MessageVersion)(context)


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 BinaryMessageEncodingBindingElement is the binding element that specified the .NET Binary Format for XML should be used for encoding messages, and has options to specify the character encoding and the SOAP and WS-Addressing version to be used. Binary encoding is most efficient but least interoperable of the encoding options.

For more information about the binding element that specifies messages are encoded using a textual representation of XML, see TextMessageEncodingBindingElement.

For more information about the binding element that specifies messages are encoded using the MTOM message encoding, see MtomMessageEncodingBindingElement.

To implement a custom message encoder, use the MessageEncodingBindingElement class.


BinaryMessageEncodingBindingElement() BinaryMessageEncodingBindingElement() BinaryMessageEncodingBindingElement()

Initializes a new instance of the BinaryMessageEncodingBindingElement class.


CompressionFormat CompressionFormat CompressionFormat

Gets or sets the compression format for the binding element.

MaxReadPoolSize MaxReadPoolSize MaxReadPoolSize

Gets or sets the maximum number of XML readers that are allocated to a pool and are ready for use to process incoming messages.

MaxSessionSize MaxSessionSize MaxSessionSize

Gets or sets the maximum amount of memory available within a session for optimizing transmission procedures.

MaxWritePoolSize MaxWritePoolSize MaxWritePoolSize

Gets or sets the maximum number of XML writers that are allocated to a pool and are ready for use to process outgoing messages.

MessageVersion MessageVersion MessageVersion

Gets or sets the SOAP message and WS-Addressing versions that are used or expected.

ReaderQuotas ReaderQuotas ReaderQuotas

Gets constraints on the complexity of XML messages that can be processed by endpoints configured with this binding element.


BuildChannelFactory<TChannel>(BindingContext) BuildChannelFactory<TChannel>(BindingContext) BuildChannelFactory<TChannel>(BindingContext)

Builds the channel factory stack on the client that creates a specified type of channel for a specified context.

BuildChannelListener<TChannel>(BindingContext) BuildChannelListener<TChannel>(BindingContext) BuildChannelListener<TChannel>(BindingContext)

Builds the channel listener on the service that accepts a specified type of channel for a specified context.

CanBuildChannelFactory<TChannel>(BindingContext) CanBuildChannelFactory<TChannel>(BindingContext) CanBuildChannelFactory<TChannel>(BindingContext)

Returns a value that indicates whether the binding element can build a channel factory for a specific type of channel.

(Inherited from BindingElement)
CanBuildChannelListener<TChannel>(BindingContext) CanBuildChannelListener<TChannel>(BindingContext) CanBuildChannelListener<TChannel>(BindingContext)

Returns a value that indicates whether the current binding can build a listener for a specified type of channel and context.

Clone() Clone() Clone()

Creates a new BinaryMessageEncodingBindingElement object initialized from the current one.

CreateMessageEncoderFactory() CreateMessageEncoderFactory() CreateMessageEncoderFactory()

Creates a factory for binary message encoders that employ the SOAP and WS-Addressing versions and the character encoding specified by the current encoding binding element.

Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetProperty<T>(BindingContext) GetProperty<T>(BindingContext) GetProperty<T>(BindingContext)

Returns a typed object requested, if present, from the appropriate layer in the binding element stack.

GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ShouldSerializeMessageVersion() ShouldSerializeMessageVersion() ShouldSerializeMessageVersion()

Returns whether the SOAP message structure version should be serialized.

ShouldSerializeReaderQuotas() ShouldSerializeReaderQuotas() ShouldSerializeReaderQuotas()

Returns whether the values of constraints placed on the complexity of SOAP message structure should be serialized.

ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

IPolicyExportExtension.ExportPolicy(MetadataExporter, PolicyConversionContext) IPolicyExportExtension.ExportPolicy(MetadataExporter, PolicyConversionContext) IPolicyExportExtension.ExportPolicy(MetadataExporter, PolicyConversionContext)

Writes a custom binary message encoding elements into the generated metadata for an endpoint.

IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext) IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext) IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext)

Writes a custom binary message encoding elements into the generated WSDL for a contract.

IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext) IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext) IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext)

Writes a custom binary message encoding elements into the generated WSDL for an endpoint.

Applies to