Reputation: 183
Does anyone know this problem:
"The underlying connection was closed: An unexpected error occurred on a receive."?
How can we resolve this problem?
Upvotes: 0
Views: 3415
Reputation: 23289
A Google search for "The underlying connection was closed: An unexpected error occurred on a receive." throws these results.
From there this post:
...I have added the following code to my reference.cs file (which needs to be done each time I update the webservice reference) to assign the keepalive value to false to allow the connection to be closed and reopened.
protected override WebRequest GetWebRequest(Uri uri) { HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri); webRequest.KeepAlive = false; webRequest.ProtocolVersion=HttpVersion.Version10; return webRequest; } I have also added a reference to System.Net via a using statement to
import the HttpWebRequest namespace.
Upvotes: 0
Reputation: 6846
This is a generic error that can be caused by just about anything (In my case some tiff images were causing gdi+ error in a wcf service).
Start by checking:
Upvotes: 0
Reputation: 183
I have increased shutdown time in the application pool and now it's work fine.
Upvotes: 1
Reputation: 38956
yes, "the underlying connection was closed", or more precisely the browser was closed before the page loaded.
There's always the chance it's a real network level error (ie, bad proxy) but you don't provide enough detail.
Upvotes: 0