BinaryMessageEncodingBindingElement Class
The binding element that specifies the .NET Binary Format for XML used to encode messages.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
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 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);
System.ServiceModel.Channels.BindingElement
System.ServiceModel.Channels.MessageEncodingBindingElement
System.ServiceModel.Channels.BinaryMessageEncodingBindingElement
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.