BinaryMessageEncodingBindingElement 類別

定義

繫結項目,可指定 XML 用來編碼訊息的 .NET 二進位格式。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
type BinaryMessageEncodingBindingElement = class
    inherit MessageEncodingBindingElement
    interface IWsdlExportExtension
    interface IPolicyExportExtension
Public NotInheritable Class BinaryMessageEncodingBindingElement
Inherits MessageEncodingBindingElement
Implements IPolicyExportExtension, IWsdlExportExtension
繼承
BinaryMessageEncodingBindingElement
實作

範例

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)

備註

編碼是將訊息轉換成位元組序列的處理序,Encoding is the process of transforming a message into a sequence of bytes. 解碼則是相反的處理序。Decoding is the reverse process. Windows Communication Foundation (WCF) 包含 SOAP 訊息的三種編碼類型:文字、二進位和訊息傳輸最佳化機制 (MTOM)。Windows Communication Foundation (WCF) includes three types of encoding for SOAP messages: Text, Binary and Message Transmission Optimization Mechanism (MTOM).

BinaryMessageEncodingBindingElement 是繫結項目,指定應該使用 XML 的 .NET 二進位格式來編碼訊息。BinaryMessageEncodingBindingElement is the binding element that specifies that the .NET Binary Format for XML should be used for encoding messages. 它有選項可指定要使用的字元編碼方式和 SOAP 和 WS-ADDRESSING 版本。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.

如需有關指定訊息的繫結項目的詳細資訊,請使用 XML 的文字標記法來編碼,請參閱 TextMessageEncodingBindingElementFor more information about the binding element that specifies messages are encoded using a textual representation of XML, see TextMessageEncodingBindingElement.

如需有關使用 MTOM 訊息編碼來編碼指定訊息之繫結項目的詳細資訊,請參閱 MtomMessageEncodingBindingElementFor more information about the binding element that specifies messages are encoded using the MTOM message encoding, see MtomMessageEncodingBindingElement.

如果要實作自訂訊息編碼器,請使用 MessageEncodingBindingElement 類別。To implement a custom message encoder, use the MessageEncodingBindingElement class.

建構函式

BinaryMessageEncodingBindingElement()

初始化 BinaryMessageEncodingBindingElement 類別的新執行個體。Initializes a new instance of the BinaryMessageEncodingBindingElement class.

屬性

CompressionFormat

取得或設定繫結項目的壓縮格式。Gets or sets the compression format for the binding element.

MaxReadPoolSize

取得或設定 XML 讀取器的數目上限,這些是配置於集區、準備用來處理傳入訊息的讀取器。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

取得或設定 XML 寫入器的數目上限,這些是配置於集區、準備用來處理傳出訊息的寫入器。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

取得或設定已使用或需要使用的 SOAP 訊息和 WS-Addressing 版本。Gets or sets the SOAP message and WS-Addressing versions that are used or expected.

ReaderQuotas

取得或設定 XML 訊息複雜度的條件約束,而這些條件約束可由以此繫結項目所設定的端點處理。Gets or sets constraints on the complexity of XML messages that can be processed by endpoints configured with this binding element.

方法

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)

傳回值,指出繫結項目是否可以建置 (Build) 特定通道類型的通道處理站。Returns a value that indicates whether the binding element can build a channel factory for a specific type of channel.

(繼承來源 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()

新建一個從目前 BinaryMessageEncodingBindingElement 物件初始化的這類物件。Creates a new BinaryMessageEncodingBindingElement object initialized from the current one.

CreateMessageEncoderFactory()

建立二進位訊息編碼器處理站,這個處理站會採用目前編碼繫結項目所指定的 SOAP 和 WS-Addressing 版本與字元編碼。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.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetProperty<T>(BindingContext)

從繫結項目堆疊的適當層次中,傳回要求的型別物件 (如果有的話)。Returns a typed object requested, if present, from the appropriate layer in the binding element stack.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ShouldSerializeMessageVersion()

傳回 SOAP 訊息結構版本是否應該序列化。Returns whether the SOAP message structure version should be serialized.

ShouldSerializeReaderQuotas()

傳回是否應序列化針對 SOAP 訊息結構複雜度所設立的約束條件值。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.

(繼承來源 Object)

明確介面實作

IPolicyExportExtension.ExportPolicy(MetadataExporter, PolicyConversionContext)

將自訂的二進位訊息編碼項目寫入為端點產生的中繼資料。Writes a custom binary message encoding elements into the generated metadata for an endpoint.

IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext)

將自訂的二進位訊息編碼項目寫入為合約產生的 WSDL。Writes a custom binary message encoding elements into the generated WSDL for a contract.

IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext)

將自訂的二進位訊息編碼項目寫入為端點產生的 WSDL。Writes a custom binary message encoding elements into the generated WSDL for an endpoint.

適用於