繁体   English   中英

将大数据从WCF服务返回到ASP.NET Web服务

[英]Return large data from WCF Service to ASP.NET Web Service

因此,我们有了控制台托管的WCF服务和ASP.NET WEB服务(在IIS上)。 经过一些艰苦的操作后,WCF服务必须将一些(大)数据返回到ASP.NET Web服务进行下一步处理。 我测试了一些小结果,一切正常。 但是,在对接近于4.5 MB的序列化结果对象的实际数据进行测试之后,ASP.NET Web服务(wcf-client-server通信中的客户端)发生错误。

这是我得到的错误:

套接字连接已中止。 这可能是由于处理您的消息时出错,远程主机超出了接收超时或潜在的网络资源问题引起的。 本地套接字超时为“ 04:00:00”。 内部异常:SocketException:“远程主机强行关闭了现有连接” ErrorCode = 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在客户端和服务器上设置MaxObjectsInGraph属性。

感谢您的回答。

通过以编程方式将MaxObjectsInGraph(用于序列化程序)设置为服务属性可以解决此问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM