Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

BinaryMessageEncodingBindingElement Class

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

Namespace:  System.ServiceModel.Channels
Assembly:  System.ServiceModel (in System.ServiceModel.dll)
public sealed class BinaryMessageEncodingBindingElement : MessageEncodingBindingElement, 
	IWsdlExportExtension, IPolicyExportExtension

The BinaryMessageEncodingBindingElement type exposes the following members.

  NameDescription
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsBinaryMessageEncodingBindingElementInitializes a new instance of the BinaryMessageEncodingBindingElement class.
Top
  NameDescription
Public propertySupported in .NET for Windows Store appsCompressionFormatGets or sets the compression format for the binding element.
Public propertyMaxReadPoolSizeGets or sets the maximum number of XML readers that are allocated to a pool and are ready for use to process incoming messages.
Public propertySupported in .NET for Windows Store appsMaxSessionSizeGets or sets the maximum amount of memory available within a session for optimizing transmission procedures.
Public propertyMaxWritePoolSizeGets or sets the maximum number of XML writers that are allocated to a pool and are ready for use to process outgoing messages.
Public propertySupported by Portable Class LibrarySupported in .NET for Windows Store appsMessageVersionGets or sets the SOAP message and WS-Addressing versions that are used or expected. (Overrides MessageEncodingBindingElement.MessageVersion.)
Public propertySupported in .NET for Windows Store appsReaderQuotasGets constraints on the complexity of XML messages that can be processed by endpoints configured with this binding element.
Top
  NameDescription
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsBuildChannelFactory<TChannel>Builds the channel factory stack on the client that creates a specified type of channel for a specified context. (Overrides BindingElement.BuildChannelFactory<TChannel>(BindingContext).)
Public methodBuildChannelListener<TChannel>Builds the channel listener on the service that accepts a specified type of channel for a specified context. (Overrides BindingElement.BuildChannelListener<TChannel>(BindingContext).)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsCanBuildChannelFactory<TChannel>Returns a value that indicates whether the binding element can build a channel factory for a specific type of channel. (Inherited from BindingElement.)
Public methodCanBuildChannelListener<TChannel>Returns a value that indicates whether the current binding can build a listener for a specified type of channel and context. (Overrides BindingElement.CanBuildChannelListener<TChannel>(BindingContext).)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsCloneCreates a new BinaryMessageEncodingBindingElement object initialized from the current one. (Overrides BindingElement.Clone().)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsCreateMessageEncoderFactoryCreates 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. (Overrides MessageEncodingBindingElement.CreateMessageEncoderFactory().)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodSupported in .NET for Windows Store appsGetProperty<T>Returns a typed object requested, if present, from the appropriate layer in the binding element stack. (Overrides MessageEncodingBindingElement.GetProperty<T>(BindingContext).)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodShouldSerializeMessageVersionReturns whether the SOAP message structure version should be serialized.
Public methodShouldSerializeReaderQuotasReturns whether the values of constraints placed on the complexity of SOAP message structure should be serialized.
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsToStringReturns a string that represents the current object. (Inherited from Object.)
Top
  NameDescription
Explicit interface implemetationPrivate methodIPolicyExportExtension.ExportPolicyWrites a custom binary message encoding elements into the generated metadata for an endpoint.
Explicit interface implemetationPrivate methodIWsdlExportExtension.ExportContractWrites a custom binary message encoding elements into the generated WSDL for a contract.
Explicit interface implemetationPrivate methodIWsdlExportExtension.ExportEndpointWrites a custom binary message encoding elements into the generated WSDL for an endpoint.
Top

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);

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.