远程主机使用 WCF 强行关闭了现有连接 [英] An existing connection was forcibly closed by the remote host with WCF

查看:25
本文介绍了远程主机使用 WCF 强行关闭了现有连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个 wcf pub/sub 设置,通过 netTcpBinding 使用可靠的会话,并且在发布服务和订阅服务都托管在控制台应用程序中的一台机器上,我们收到了上述错误.这台机器在一个工作组中.我们部署机器的其他地方都在一个域中,它工作正常.我对 wcf 的了解有些有限,这是刚刚交给我的,所以请耐心等待.有人对如何解决此错误有任何建议吗?

We have a wcf pub/sub setup using reliable sessions via netTcpBinding and on one machine where both the publication service and subscription service are being hosted in a console applications we get the above error. This machine is in a workgroup. Everywhere else we have deployed the machine is in a domain and it works fine. My knowledge of wcf is somewhat limited and this has just been handed to me so please be patient. Does anyone have any advice on how to resolve this error?

完整的例外如下:

System.ServiceModel.CommunicationException套接字连接已中止.这可能是由于处理您的消息时出错或远程主机超过接收超时,或底层网络资源问题引起的.本地套接字超时为10675199.02:48:05.4775807".
在 System.ServiceModel.Channels.SocketConnection.EndRead()在 System.ServiceModel.Channels.DelegatingConnection.EndRead()在 System.ServiceModel.Channels.TracingConnection.EndRead()在 System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.HandleRead()在 System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.OnAsyncReadComplete(对象状态)在 System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()在 System.ServiceModel.Channels.SocketConnection.FinishRead()在 System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead)在 System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 错误,UInt32 bytesRead,NativeOverlapped* nativeOverlapped)在 System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)内部异常:
System.Net.Sockets.SocketException
远程主机强行关闭了现有连接
在 System.ServiceModel.Channels.SocketConnection.EndRead()在 System.ServiceModel.Channels.DelegatingConnection.EndRead()在 System.ServiceModel.Channels.TracingConnection.EndRead()在 System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.HandleRead()在 System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.OnAsyncReadComplete(对象状态)在 System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()在 System.ServiceModel.Channels.SocketConnection.FinishRead()在 System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead)在 System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 错误,UInt32 bytesRead,NativeOverlapped* nativeOverlapped)在 System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

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'.
at System.ServiceModel.Channels.SocketConnection.EndRead() at System.ServiceModel.Channels.DelegatingConnection.EndRead() at System.ServiceModel.Channels.TracingConnection.EndRead() at System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.HandleRead() at System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.OnAsyncReadComplete(Object state) at System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback() at System.ServiceModel.Channels.SocketConnection.FinishRead() at System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead) at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) Inner exception:
System.Net.Sockets.SocketException
An existing connection was forcibly closed by the remote host
at System.ServiceModel.Channels.SocketConnection.EndRead() at System.ServiceModel.Channels.DelegatingConnection.EndRead() at System.ServiceModel.Channels.TracingConnection.EndRead() at System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.HandleRead() at System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.OnAsyncReadComplete(Object state) at System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback() at System.ServiceModel.Channels.SocketConnection.FinishRead() at System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead) at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

我的绑定配置如下:

<netTcpBinding>
    <binding name="NetTcpBinding_ISubscriptionService"
             closeTimeout="00:01:00"
             openTimeout="00:01:00"
             receiveTimeout="00:10:00"
             sendTimeout="00:01:00"
             transactionFlow="false"
             transferMode="Buffered"
             transactionProtocol="OleTransactions"
             hostNameComparisonMode="StrongWildcard"
             listenBacklog="10"
             maxBufferPoolSize="524288"
             maxBufferSize="65536"
             maxConnections="10"
             maxReceivedMessageSize="65536">
        <readerQuotas maxDepth="32"
                      maxStringContentLength="8192"
                      maxArrayLength="524288"
                      maxBytesPerRead="4096"
                      maxNameTableCharCount="16384" />
        <reliableSession ordered="true"
                         inactivityTimeout="00:10:00"
                         enabled="true"/>
        <security mode="Transport"
                  transport=""
                  clientCredentialType="Windows"
                  protectionLevel="EncryptAndSign"
                  message=""/>
    </binding>
</netTcpBinding>

终点是:

<endpoint address="net.tcp://localhost:8000/SubscriptionService"
          binding="netTcpBinding" 
          bindingConfiguration="NetTcpBinding_ISubscriptionService" 
          contract="SubscriptionService.ISubscriptionService" 
          name="NetTcpBinding_ISubscriptionService" />

推荐答案

好的,我找到了我的问题所在.

Ok, I found out what my problem was.

客户端应用程序连接的服务的 mxConnection 为 10.我们还使用了 SecureMessaging,并且 listenBacklog 为 1.将 maxConnections 修改为 100,将 listBacklog 修改为 200,一切正常.

The service the client application was connecting to had mxConnection of 10. We were also using SecureMessaging and had a listenBacklog of 1. Amended maxConnections to 100 and listBacklog to 200 and it all works fine.

这篇关于远程主机使用 WCF 强行关闭了现有连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆