c# - WCF - 套接字连接已中止

标签 c# .net wcf exception networking

当我在具有 TCP 绑定(bind)的远程主机上运行 WCF 服务时,出现以下异常。但是 basichttpbinding 有效。

此外,当我将它托管在同一台机器上时,它也能正常工作。

同样使用测试客户端和到远程机器的连接,TCP 也能正常工作。

为什么你认为我会收到以下异常?解决办法是什么?

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at IService1.GetSectionEntity(String id)
   at Service1Client.GetSectionEntity(String id) in C:\src\Service1.cs:line 2318
   at GetSectionSync(Id sectionId, Boolean loadFromDbIfNotInCache) 
2011-02-22 10:41:13,888|WARN | HttpHandler|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:29.9870000'.
2011-02-22 10:41:13,891|ERROR|HttpHandler|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:29.9870000'.
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 '00:00:29.9870000'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
   --- End of inner exception stack trace ---

最佳答案

如有疑问,请打开 WCF 诊断:http://msdn.microsoft.com/en-us/library/ms733025.aspx

关于c# - WCF - 套接字连接已中止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5080497/

相关文章:

c#序列化ascii混淆

c# - 如何将 Fluent MEF 注入(inject) WCF

c# - MVC + WCF + TDD 或 DDD 架构

c# - ASP.NET Web API 模型绑定(bind)复杂对象的非顺序列表

c# - 如何在 C# MVVM 中绑定(bind)一对多关系

c# - 没有操作和 Controller 的 Html.BeginForm css 属性

.net - 如何使用 COM 在 .NET 和 C++ 之间传递结构?

.net - 如何在 .NET 中使用 GetMethod 区分通用签名和非通用签名?

c# - 使用 XSD/代码生成的 XML 反序列化 - 解析错误

java - WCF 与 Spark 集成