An existing connection was forcibly closed by the remote host - WCF

后端 未结 11 656
死守一世寂寞
死守一世寂寞 2020-11-30 04:18

I have a WCF web service that is working fine. However there is one particular call that is failing - but only failing for certain users. The call is pretty simple - it is

相关标签:
11条回答
  • 2020-11-30 04:54

    I just had this error now in server only and the solution was to set a maxItemsInObjectGraph attribute in wcf web.config under <behavior> tag:

    <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
    
    0 讨论(0)
  • 2020-11-30 04:54

    I have catched the same exception and found a InnerException: SocketException. in the svclog trace.

    After looking in the windows event log I saw an error coming from the System.ServiceModel.Activation.TcpWorkerProcess class.

    Are you hosting your wcf service in IIS with netTcpBinding and port sharing?

    It seems there is a bug in IIS port sharing feature, check the fix:

    My solution is to host your WCF service in a Windows Service.

    0 讨论(0)
  • 2020-11-30 04:55

    The best thing I've found for diagnosing things like this is the service trace viewer. It's pretty simple to set up (assuming you can edit the configs):

    http://msdn.microsoft.com/en-us/library/ms732023.aspx

    Hope this helps.

    0 讨论(0)
  • 2020-11-30 04:57

    I have seen this once. Are the users requesting different amounts of data? I found that even if you can configure a binding for data payloads (i.e. maxReceivedMessageSize), the httpRuntime maxRequestLength trumps the WCF setting, so if IIS is trying to serve a request that exceeds that, it exhibits this behavior.

    Think of it like this:

    If maxReceivedMessageSize is 12MB in your WCF behavior, and maxRequestLength is 4MB (default), IIS wins.

    0 讨论(0)
  • 2020-11-30 04:57

    The issue I had was also with serialization. The cause was some of my DTO/business classes and properties were renamed or deleted without updating the service reference. I'm surprised I didn't get a contract filter mismatch error instead. But updating the service ref fixed the error for me (same error as OP).

    0 讨论(0)
  • 2020-11-30 05:03

    I' ve got the same problem. My solution is this :

    If you using LinQ2SQL in your project, Open your dbml file in Visual Studio and change Serialization Mode to "Unidirectional" on

    0 讨论(0)
提交回复
热议问题