WCF采用 netTcpBinding 发生的Socket errors

最近在项目中采用 Windows service 作为WCF services的宿主, 在服务和客户端的调用上没有发生如何的异常和错误,但是经常发生下述错误:

“System.ServiceModel.CommunicationException: 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 '10675199.02:48:05.4775807'”

下面是一个解决方案:当使用WCF 服务使用 netTcpBinding 时,需要在客户端代理调用方法close()关闭代理,将服务的实例放回到池中。

WCF服务使用WSHttp或者BasicHttp的时候没有这个问题。

欢迎大家扫描下面二维码成为我的客户,为你服务和上云

原文地址:https://www.cnblogs.com/shanyou/p/1296061.html