Will the "Underlying connection closed" bug be fixed?

  • Thread starter Thread starter Sin Jeong-hun
  • Start date Start date
S

Sin Jeong-hun

I don't get the message so it's hard to debug that, but some of my
clients report that they get "The underlying connection was closed
unexpectedly" exception. According to this site (http://
www.dotnetspider.com/resources/2596-e-underlying-connection-was-closed-A-connection.aspx),
it's a bug of .NET 2.0, and the author suggests that we use
KeepAlive=false until Microsoft fixes it.

It seems like almost 5 years have passes since the release of .NET
2.0, and this stilll exists. Should I wait for the fix, or use
KeepAlive=false instead?
 
Thanks. I created separate WebRequests for each request using
WebRequest.Create(), and common underlying connection seems to be managed by
the .NET framework. I didn't explicitly tell .NET framework to use the same
connection for every requests. And it also looks like there is no way access
the underlying connection (opened by the .NET framework), to check if the
connection is closed or not before sending the request.

Shouldn't the .NET framework check if the connection is closed or not , then
open and use a new connection if it has been closed by web server before
sending a new request ? Checking this for every request and try again seems
to be a lot of typing overhead.

If .NET doesn't do that, is there any way to check if the underlying
connection is closed or not before sending the request?
 
Back
Top