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

后端 未结 11 657
死守一世寂寞
死守一世寂寞 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 05:04

    I had this issue start happening when debugging from one web project to a web service in the same solution. The web service was returning responses that the web project couldnt understand. It would kind of work again at some points, then stop again.

    It was because there was not an explicit reference between these projects, so the web service was not getting built when hitting F5 to start debugging. Once I added that, the errors went away.

    0 讨论(0)
  • I had this issue because my website did not have a certificate bound to the SSL port. I thought I'd mention it because I didn't find this answer anywhere in the googleweb and it took me hours to figure it out. Nothing showed up in the event viewer, which was totally awesome for diagnosing it. Hope this saves someone else the pain.

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

    I found that you can get this error if the returned object has getter only auto properties that are initialized in the constructor (with C# 6.0 syntax).

    I believe this is due to WCF deserializing objects on the client side using a parameter-less constructor then setting the properties on the object. It needs to have a set available (it can be private) to fill the object, otherwise it'll fail.

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

    After pulling my hair out for like 6 hours of this completely useless error, my problem ended up being that my data transfer objects were too complex. Start with uber simple properties like public long Id { get; set;} that's it... nothing fancy.

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

    In my case it was also with serialization. I need to add [KnownType(typeof(...)] for all the classes that could appear in the serialization.

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