WCF错误集合

(使用Windows Service作为宿主的时候也会出现这样的情况,搜索的) 我们这里是自定义托管宿主,在进行WCF编程开发过程时,使用NetTcpBinding绑定协议,作为通讯协议,可能会引发这样的异常,导致数据如法传输。套接字连接中断,可能是由于消息处理错误,或者远程宿主接受超时引起,或者是底层网络资源问题导致,本地套接字时间是'00:00:59.7656250'。具体信息如下:

  The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.7656250'.

   此问题的的解决办法:

   我查询了很多资料,国外论坛也有人已经遇到这样的问题。

  1.http://social.msdn.microsoft.com/forums/en-US/wcf/thread/637e6097-9161-40ee-8578-46388b7647cd

  2.http://social.msdn.microsoft.com/forums/en-US/wcf/thread/06cb1522-31f0-4ce3-85f0-02656228a8e1/

  这个是两个MSDN上讨论的解决办法,更换其他的绑定协议确实可以解决问题。

  参考代码如下:

WSHttpBinding binding = new WSHttpBinding();
binding.ReceiveTimeout = new TimeSpan(10, 10, 10);

  我测试的结果使用basicHttpBinding协议也可以,不会出现这样的异常。

  如果大家有好的经验,也欢迎补充。

  系列文章:

  WCF分布式开发常见错误解决(1):An error occurred while attempting to find services at...添加服务引用出错

  WCF分布式开发常见错误解决(2)无法从传输连接中读取数据: 远程主机强迫关闭了一个现有的连接

  WCF分布式开发常见错误解决(3):客户端调用服务出错
  WCF分布式开发常见错误解决(4):The type or namespace name 'DataContract' could not be found DataContract找不到

  WCF分布式开发常见错误解决(5)Could not find a base address that matches scheme

  WCF分布式开发常见错误解决(6)Service 'WcfServiceApp.WCFService' has zero application

  WCF分布式开发常见错误解决(7):System.InvalidOperationException,Cannot have two operations in the same contract

  WCF分布式开发常见错误解决(8):不一致的访问性Inconsistent accessibility
  WCF分布式开发常见错误解决(9):无终结点监听,There was no endpoint listening at

  WCF分布式开发常见错误解决(11):There is already a listener on IP endpoint ,IP 终结点 已经存在侦听器

  WCF分布式开发常见错误解决(12):The server was unable to process the request,服务无法处理请求

  WCF分布式开发常见错误(13):The transaction under which this method call was executing ,此方法调用的事务被异步中断

  WCF分布式开发常见错误(14):无效的操作异常,At least one operation on the ...

  WCF分布式开发常见错误(15):Communication with the underlying transaction manager has failed

  WCF分布式开发常见错误(16):The Transaction has aborted,事务已经被中断

  WCF分布式开发常见错误(17):无法启动MSMQ服务

本篇文章来自<A href='http://www.soidc.net'>IDC专家网</a> 原文链接:http://www.soidc.net/articles/1213781277395/20090615/1215945539001_1.html

具体参考

http://www.soidc.net/topic/%B7%D6%B2%BC%CA%BD%CD%A8%D1%B6%B4%ED%CE%F3

原文地址:https://www.cnblogs.com/si812cn/p/1767841.html