2010-02-03 117 views
0

因此,我們擁有控制檯託管的WCF服務和ASP.NET Web服務(在IIS上)。 經過一些艱難的操作後,WCF服務必須將一些(大型)數據返回給ASP.NET Web服務以進行下一步處理。我測試的結果很小,一切都很好。 但是,在對4.5 MB附近的序列化結果對象的真實數據進行測試之後,ASP.NET Web服務(它是wcf-client-server通信中的客戶端)發生錯誤。從WCF服務返回大量數據到ASP.NET Web服務

這是我得到的錯誤:

套接字連接被中止。這可能是由於處理您的消息的錯誤 或遠程主機的 接收超時或基礎網絡資源問題所致。本地套接字 超時時間爲'04:00:00'。內異常:SocketException:「一個現有 連接被強行關閉遠程主機」錯誤碼= 10054

消息大小由下一個綁定配置(在服務器和客戶端):

NetTcpBinding netTcpBinding = new NetTcpBinding(); 
netTcpBinding.TransactionFlow = true; 
netTcpBinding.SendTimeout = new TimeSpan(0, 4,0, 0); 
netTcpBinding.Security.Mode = SecurityMode.None; 
netTcpBinding.Security.Message.ClientCredentialType = MessageCredentialType.None; 
netTcpBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None; 
netTcpBinding.Security.Transport.ProtectionLevel = ProtectionLevel.None; 
netTcpBinding.MaxReceivedMessageSize = 2147483647; 
netTcpBinding.MaxBufferSize = 2147483647; 
netTcpBinding.MaxBufferPoolSize = 0; 
netTcpBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue; 
netTcpBinding.ReaderQuotas.MaxArrayLength = int.MaxValue; 
netTcpBinding.ReaderQuotas.MaxBytesPerRead = int.MaxValue; 
netTcpBinding.ReaderQuotas.MaxDepth = 32; 
netTcpBinding.ReaderQuotas.MaxNameTableCharCount = 16384; 

MaxObjectsInGraph屬性在配置文件中配置。

你能告訴我什麼?另外我還需要示例如何以編程方式在客戶端和服務器上設置MaxObjectsInGraph屬性。

感謝您的回答。

回答

0

問題通過以編程方式將MaxObjectsInGraph(用於序列化程序)設置爲服務屬性來解決。