แก้ไข

แชร์ผ่าน


BinaryMessageEncodingBindingElement Class

Definition

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

public ref class BinaryMessageEncodingBindingElement sealed : System::ServiceModel::Channels::MessageEncodingBindingElement
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
public sealed class BinaryMessageEncodingBindingElement : System.ServiceModel.Channels.MessageEncodingBindingElement, System.ServiceModel.Description.IPolicyExportExtension, System.ServiceModel.Description.IWsdlExportExtension
type BinaryMessageEncodingBindingElement = class
    inherit MessageEncodingBindingElement
type BinaryMessageEncodingBindingElement = class
    inherit MessageEncodingBindingElement
    interface IWsdlExportExtension
    interface IPolicyExportExtension
Public NotInheritable Class BinaryMessageEncodingBindingElement
Inherits MessageEncodingBindingElement
Public NotInheritable Class BinaryMessageEncodingBindingElement
Inherits MessageEncodingBindingElement
Implements IPolicyExportExtension, IWsdlExportExtension
Inheritance
BinaryMessageEncodingBindingElement
Implements

Examples

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

var binding = new CustomBinding();
var bpCol = new BindingParameterCollection();
var context = new BindingContext(binding, bpCol);
be.BuildChannelFactory<IDuplexChannel>(context);

var binding2 = new CustomBinding();
var bpCol2 = new BindingParameterCollection();
var 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).

BinaryMessageEncodingBindingElement is the binding element that specifies that the .NET Binary Format for XML should be used for encoding messages. It has options to specify the character encoding and the SOAP and WS-Addressing version to be used. Binary encoding is the 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 or sets 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.

BuildChannelListener<TChannel>(BindingContext)

Initializes a channel listener to accept channels of a specified type from the binding context.

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

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

CanBuildChannelListener<TChannel>(BindingContext)

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

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

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

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

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

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

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current 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()

Returns a string that represents the current object.

(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