不支援正在使用的 .Net 組幀模式。有關詳細資料,請參閱伺服器日誌--解決方案是否

來源:互聯網
上載者:User

標籤:

問題在於 NetTcpBinding 服務端和用戶端配置不一致。

至少  用戶端和服務端:安全性、是否啟用可靠會話以及傳輸方式必須一致

主要是傳輸方式導致 "不支援正在使用的 .Net 組幀模式"。

安全性和是否啟用可靠會話不一致 導致錯誤 " 通訊端串連已中止。這可能是由於處理訊息時出錯或遠程主機超過接收逾時或者潛在的網路資源問題導致的。本地通訊端逾時是“00:01:59.9839991”。 ---> System.Net.Sockets.SocketException: 遠程主機強迫關閉了一個現有的串連。"

 用戶端代碼配置
1
EndpointAddress ea = new EndpointAddress(url); 2 //安全性 none 是否啟用可靠會話 false 3 NetTcpBinding tc = new NetTcpBinding(SecurityMode.None, false) 4 { 5 ReceiveTimeout = new TimeSpan(10, 10, 10), 6 TransferMode = TransferMode.Streamed,///傳輸方式 7 MaxReceivedMessageSize = 1073741824, 8 SendTimeout = new TimeSpan(0, 2, 0) 9 };10 return ChannelFactory<T>.CreateChannel(tc, ea);
服務端代碼配置

1
ServiceHost host = ContractDescription.GetContract(typeof(IService1));2 //安全性 none 是否啟用可靠會話 false3 NetTcpBinding tc = new NetTcpBinding(SecurityMode.None, false);4 //tc.MaxReceivedMessageSize = 2147483647;5 //傳輸方式6 tc.TransferMode = TransferMode.Streamed;7 //tc.SendTimeout = new TimeSpan(10, 10, 0);8 //tc.ReceiveTimeout = new TimeSpan(0, 2, 10);9 host.AddServiceEndpoint(iType, tc, string.Concat("net.tcp://localhost:8990/service/"));
 服務端xml 配置

1
<bindings> 2 <netTcpBinding > 3 <binding name="TcpBinding" maxReceivedMessageSize="2147483647" transferMode="Streamed" > 4 <security mode="None"> 5 <transport clientCredentialType="None"/> 6 <message clientCredentialType="None"/> 7 </security> 8 <reliableSession enabled="false"/> 9 <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>10 </binding>11 </netTcpBinding>12 </bindings>
//
<security mode="None"> //設定傳輸 安全性 none
//<reliableSession enabled="false"/> //不啟用可靠會話 false
//transferMode 傳輸方式

 

不支援正在使用的 .Net 組幀模式。有關詳細資料,請參閱伺服器日誌--解決方案是否

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.