title: WCF Error - Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host
body: <p>I am consuming a WCF service which has two functions, <code>GetAllProducts()</code> to return all products and <code>GetProductById(int id)</code> to return one product.</p>
  
  <p><code>GetAllProducts()</code> returns all data and <code>GetProductById()</code> does not return anything and produces this error.</p>
  
  <p>There shouldn't be any problem within the WCF service communication itself as <code>GetAllProducts()</code> is returning data. Does any one have any idea ?</p>
  
  <p>ERROR :</p>
  
  <p>An error occurred while receiving the HTTP response to <a href="http://XX.XXX:92/" rel="nofollow noreferrer">http://XX.XXX:92/</a>. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.</p>
  
  <p>Server stack trace: 
     at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
     at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
     at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
     at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)</p>
  
  <p>Exception rethrown at [0]: 
     at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
     at IData.GetProductById(Int32 ProductId)
     at DataClient.GetProductById(Int32 ProductId)</p>
  
  <p>Inner Exception:
  The underlying connection was closed: An unexpected error occurred on a receive.
     at System.Net.HttpWebRequest.GetResponse()
     at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)</p>
  
  <p>Inner Exception:
  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)</p>
  
  <p>Inner Exception:
  An existing connection was forcibly closed by the remote host
     at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
     at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)</p>