远程主机使用WCF强制关闭现有连接

Joh*_*ohn 8 wcf

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

完整的例外情况如下:

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(布尔haveResult,的Int32错误,的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
现有连接是forcib LY关闭由远程主机
在System.ServiceModel.Channels.SocketConnection.EndRead()在System.ServiceModel.Channels.DelegatingConnection.EndRead()在System.ServiceModel.Channels.TracingConnection.EndRead()在System.ServiceModel.Channels.ConnectionStream系统中的System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()处于System.ServiceModel.Channels.SocketConnection.FinishRead()的System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.OnAsyncReadComplete(Object state)中的.ReadAsyncResult.HandleRead() .ServiceModel.Channels.SocketConnection.AsyncReadCallback(布尔haveResult,的Int32错误,的Int32 bytesRead)在System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32的误差,UInt32的bytesRead,NativeOverlapped*nativeOverlapped)在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>
Run Code Online (Sandbox Code Playgroud)

端点是:

<endpoint address="net.tcp://localhost:8000/SubscriptionService"
          binding="netTcpBinding" 
          bindingConfiguration="NetTcpBinding_ISubscriptionService" 
          contract="SubscriptionService.ISubscriptionService" 
          name="NetTcpBinding_ISubscriptionService" />
Run Code Online (Sandbox Code Playgroud)

Joh*_*ohn 3

好吧,我知道我的问题是什么了。

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