Jan Thielen (MVP) gives a solution to the problem of sporadic errors of type "The underlying connection was closed".
In essence, you need to add the following code to your Webreference's Reference.cs file:
protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
System.Net.HttpWebRequest webRequest =
(System.Net.HttpWebRequest) base.GetWebRequest(uri);
webRequest.KeepAlive = false; return webRequest;
}
No comments:
Post a Comment