我在嘗試將netTcpBinding轉換爲customBinding。如何將netTcpBinding轉換爲customBinding?
這裏是NetTcpBinding的配置:
<netTcpBinding>
<binding name="DuplexBinding" sendTimeout="00:00:30" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<reliableSession enabled="true" ordered="true"/>
<security mode="Message">
<message clientCredentialType="UserName"/>
</security>
</binding>
</netTcpBinding>
我創建了一個CustomDuplexBinding:
<customBinding>
<binding name="CustomDuplexBinding" sendTimeout="00:00:30">
<transactionFlow />
<reliableSession ordered="true"/>
<security authenticationMode="UserNameForCertificate" enableUnsecuredResponse="true">
<secureConversationBootstrap authenticationMode="UserNameForCertificate" />
</security>
<compositeDuplex />
<oneWay />
<binaryMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binaryMessageEncoding>
<sslStreamSecurity requireClientCertificate="false"/>
<tcpTransport maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"/>
</binding>
</customBinding>
但是當我運行,以下異常已發生:
綁定「CustomDuplexBind ing'不支持創建任何通道類型。 這通常表示CustomBinding中的BindingElements有 堆疊不正確或順序錯誤。在堆棧底部需要一個Transport爲 。 BindingElements的推薦順序是:TransactionFlow,ReliableSession,Security, CompositeDuplex,OneWay,StreamSecurity,MessageEncoding,Transport。
任何人都可以請幫我解決這個問題嗎?
您是否嘗試切換''和''的順序? –
Tim
我試圖切換順序並得到異常:「_ Binding'CustomBinding',TransportBindingElement'TcpTransportBindingElement'不會出現在BindingElementCollection的最後,請更改元素的順序,使TransportBindingElement爲last_。」 – Dmitriy