Wcf procy api call fails with error - the underlying connection was closed: an unexpected error occurred on a receive. RRS feed

  • Question

  • I am self hosting a WCF service on winXP sp3 machine and the client is on the same machine.I tried to call the service api and it gave me following error 
    An existing connection was forcibly closed by the remote host 
    Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
                                                                                     at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
                                                                                     at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
                                                                                     at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
                                                                                  The underlying connection was closed: An unexpected error occurred on a receive.
    But same service when hosted on remote machine and client accessing service is on windows xpsp3 machine then it works.
    Is there a known issue for winxpsp3 machine when both client and service are on same machine.
    Thanks in advance

    • Edited by Bineeshtk Friday, December 2, 2016 8:28 AM
    Friday, December 2, 2016 8:26 AM

All replies

  • I hosted service using localhost in the endpoint URL and same for client proxy.On Win XPSP3 I observed that by changing the machine name from "Localhost" to "" the communication was working as expected.
    But on winXPSP2 "localhost" works.
    Not sure whether this is related to some security patch that is present in winXPSP3

    • Edited by Bineeshtk Saturday, December 3, 2016 11:00 AM
    Friday, December 2, 2016 12:10 PM
  • Hi Bineeshtk,

    After hosting WCF service, are you able to browser the Metadata from web browser? Could you add the service reference correctly? I suggest you try Configuring Tracing to check the depth error.

    Could you share us your configuration for service and client?

    I suggest you try to host your Service on IIS.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, December 5, 2016 5:05 AM