We fixed this problem by passing a reference of the WebRequest itself (inside the Send() method in HttpService.cs) to the ResponseMessage instance created at the end. Basically, keep the web request alive as long as the ResponseMessage is being used.
HOWEVER, oddly enough, this only removes the disconnects in Debug builds (not just while debugging, but any .exe built in debug), and not in Release builds. I can't figure out why.
[In ResponseMessage.cs]
private HttpWebRequest request;
public ResponseMessage(int status, Stream content, HttpWebResponse response, HttpWebRequest request)
{
this.request = request;
this.status = status;
this.content = content;
this.response = response;
}
[in HttpService.cs, Send() method]
public virtual ResponseMessage Send(string path, RequestMessage request)
{
(...)
ResponseMessage returnResponse =
new ResponseMessage(status, input, response, webRequest);
}
Hope this helps!
... View more