none
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host 付费咨询 RRS feed

  • 问题

  • 1个WCF应用,NetTCP客户端调服务器端远程方法时(有很多远程方法不定是那1个出现,出现此错误时服务器端cpu/memory不高均正常)。每天极偶尔会出现以下错误:

    System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host (详细callstack如链接图)

    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:01:00'. ---> 
    System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host 
    at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout) 

    服务端客户端:windows 2008 r2, .net framework 4.5,windows服务器的tcp/ip注册表参数均为默认值 
    服务器端参数:
    NetTcpBinding: listenBacklog="1000",maxConnections="1000" ReceiveTimeout="12:00:00",percall
    ServiceThrottling : maxConcurrentCalls="1000",percall
    DataContractSerializer :maxItemsInObjectGraph="2147483647"

    客户端是用链接池,TCP链接建立后是保持建立状态,用后还回链接池(类似数据库链接池)
    客户端参数 :

     <TcpBinding CloseTimeout="00:01:00" OpenTimeout="00:00:10" ReceiveTimeout="00:01:00" SendTimeout="00:01:00" TransferMode="Buffered" ListenBacklog="1000" MaxBufferPoolSize="1073741824" MaxBufferSize="1073741824" MaxConnections="100" MaxReceivedMessageSize="1073741824" UseDefaultWebProxy="false" HostNameComparisonMode="StrongWildcard">
        <ReaderQuotas MaxArrayLength="163840000" MaxBytesPerRead="1048576" MaxDepth="256" MaxNameTableCharCount="163840000" MaxStringContentLength="163840000" />
      </TcpBinding>


    查了很多资源也没有结果,且无法自测重现,请大侠指点迷津.......感谢感谢。

    addition info:

    https://stackoverflow.com/questions/2582036/an-existing-connection-was-forcibly-closed-by-the-remote-host
    This generally means that the remote side closed the connection (usually by sending a TCP/IP RST packet). If you're working with a third-party application, the likely causes are:
    You are sending malformed data to the application
    The network link between the client and server is going down for some reason
    You have triggered a bug in the third-party application that caused it to crash
    The third-party application has exhausted system resources
    It's likely that the first case is what's happening.

    You can fire up Wireshark to see exactly what is happening on the wire to narrow down the problem.
    Without more specific information, it's unlikely that anyone here can really help you much.
    2019年6月21日 0:03

全部回复