BinaryMessageEncodingBindingElement Class

Definition

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

public sealed class BinaryMessageEncodingBindingElement : System.ServiceModel.Channels.MessageEncodingBindingElement, System.ServiceModel.Description.IPolicyExportExtension, System.ServiceModel.Description.IWsdlExportExtension
Inheritance
BinaryMessageEncodingBindingElement
Implements

Examples

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);
be.BuildChannelFactory<IDuplexChannel>(context);

CustomBinding binding2 = new CustomBinding();
BindingParameterCollection bpCol2 = new BindingParameterCollection();
BindingContext context2 = new BindingContext(binding2, bpCol2);
be.BuildChannelListener<IDuplexChannel>(context2);

be.CanBuildChannelListener<IDuplexChannel>(context2);
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)

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 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.

Constructors

BinaryMessageEncodingBindingElement()

Initializes a new instance of the BinaryMessageEncodingBindingElement class.

Properties

CompressionFormat

Gets or sets the compression format for the binding element.

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

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

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

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

ReaderQuotas

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

Methods

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)

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

CanBuildChannelFactory<TChannel>(BindingContext) Inherited from BindingElement
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()

Creates a new BinaryMessageEncodingBindingElement object initialized from the current one.

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) Inherited from Object
Equals(Object, Object) Inherited from Object
GetHashCode() Inherited from Object
GetProperty<T>(BindingContext)

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

GetType() Inherited from Object
MemberwiseClone() Inherited from Object
ReferenceEquals(Object, Object) Inherited from Object
ShouldSerializeMessageVersion()

Returns whether the SOAP message structure version should be serialized.

ShouldSerializeReaderQuotas()

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

ToString() Inherited from Object

Explicit Interface Implementations

IPolicyExportExtension.ExportPolicy(MetadataExporter, PolicyConversionContext)

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

IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext)

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

IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext)

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

Applies to