Binding描述了哪些層面的資訊
一個Binding包含着豐富的資訊,每種資訊都描述了服務端和用戶端互動過程中的一方面,如下表所示,Binding描述了這些層面的資訊:
層次 | 備注說明 |
Transactions(事務) | TransactionFlowBindingElement,用于指定事務流程 |
Reliability(信賴) | ReliableSessionBindingElement,用于指定對會話方式 |
Security(安全) | SecurityBindingElement,指定安全方式 |
Encoding(編碼) | Text, Binary, MTOM, Custom,指定資料傳輸格式 |
Transport(傳輸) | TCP, Named Pipes, HTTP, HTTPS, MSMQ, Custom,指定傳輸方式 |
選擇正确的Binding
Binding是可以自定義實作的,可WCF架構已經為我們實作了足夠多的Binding,供我們來選擇,
如下表所示:
Binding名稱 | Configuration Element | 描述 |
BasicHttpBinding | basicHttpBinding | 一個指定用符合基本網絡服務規範通訊的binding,它用http進行傳輸,資料格式為text/xml |
WSHttpBinding | wsHttpBinding | 一個安全的通用的binding,但它不能在deplex中使用 |
WSDualHttpBinding | wsDualHttpBinding | 一個安全的通用的binding,但能在deplex中使用 |
WSFederationHttpBinding | wsFederationHttpBinding | 一個安全的通用的支援WSF的binding,能對使用者進行驗證和授權 |
NetTcpBinding | netTcpBinding | 在wcf應用程式中最适合跨機器進行安全通訊的binding |
NetNamedPipeBinding | netNamedPipeBinding | 在wcf應用程式中最适合本機進行安全通訊的binding |
NetMsmqBinding | netMsmqBinding | 在wcf應用程式中最适合跨機器進行安全通訊的binding,并且支援排隊 |
NetPeerTcpBinding | netPeerTcpBinding | 一個支援安全的,多機互動的binding |
MsmqIntegrationBinding | msmqIntegrationBinding | 一個用于wcf與現有msmq程式進行安全通訊的binding |
下面的表格分别删除了上表中的Binding在互操作性(Interoperability), 安全性(Security), 是否支援會話(Session), 是否支援事務(Transactions)和是否為全雙工(Duplex)上不同。
Bingding | Interoperability | Security | Session | Transactions | Duplex |
Basic Profile 1.1 | (None), Transport, Message | None, (None) | None | n/a | |
WS | Transport, (Message), Mixed | (None), Transport, Reliable Session | (None), Yes | ||
(Message) | (Reliable Session) | Yes | |||
WS-Federation | (None), Reliable Session | No | |||
.NET | (Transport), Message | Reliable Session, (Transport) | |||
(Transport) | None, (Transport) | ||||
Message, (Transport), Both | (None) | ||||
Peer | |||||
MSMQ |
·BasicHttpBinding: 最簡單的綁定類型,通常用于 Web Services。使用 HTTP 協定,Text/XML 編碼方式。
·WSHttpBinding: 比 BasicHttpBinding 更加安全,通常用于 non-duplex 服務通訊。
·WSDualHttpBinding: 和 WSHttpBinding 相比,它支援 duplex 類型的服務。
·WSFederationHttpBinding: 支援 WS-Federation 安全通訊協定。
·NetTcpBinding: 效率最高,安全的跨機器通訊方式。
·NetNamedPipeBinding: 安全、可靠、高效的單機服務通訊方式。
·NetMsmqBinding: 使用消息隊列在不同機器間進行通訊。
·NetPeerTcpBinding: 使用 P2P 協定在多機器間通訊。
·MsmqIntegrationBinding: 使用現有的消息隊列系統進行跨機器通訊。如 MSMQ。
僅作參考。
片段摘自:
http://www.rainsts.net/article.asp?id=439 http://www.cnblogs.com/jillzhang/archive/2008/02/03/1063406.html部落格園大道至簡
http://www.cnblogs.com/jams742003/轉載請注明:部落格園