469,934 Members | 1,869 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

The underlying connection was closed: An unexpected error occurred

Hi,

We have an application outside the firewall who talks to a webservice inside
the firewall. 9 times of 10 this works, but sometimes we got the error "The
underlying connection was closed: An unexpected error occurred on a receive."
We have tested some of the solutions that we have found in this discussion
group but the problem still exist. We use .NET Framework 1.1. The application
server use Win2003. The webservice server use Win2003. A temporary solution
that we use now, is to let the application do a retry when the webservice
throw an error. This works, but we don't like this solution.

Please help!
Fredrik
Nov 21 '05 #1
1 7629
Hello Fredrik,

We were experiencing this exact problem when we had SSL configured (with client certs). You're not giving to many details, but this may be what is happening to you as well. (We used the Discover method to establish a connection before we sent any data. This "solved" the problem.)

http://www.microsoft.com/resources/d...eshooting.mspx

--------------------------------
Client Cannot Negotiate Request and Returns an HTTP 413 Error
If client certificates are enabled on a Web server, Web site, or on individual directories or files on the site, clients might see an HTTP 413 error when uploading large files.

If a client sends a long HTTP request, for example, a POST request, to a Web server running IIS 6.0, the IIS worker process might receive enough data to parse request headers, but not receive the entire request entity body. When the IIS worker process detects that client certificates are required to return data to the client, IIS attempts to renegotiate the client connection. However, the client cannot renegotiate the connection because it is waiting to send the remaining request data to IIS.

If client renegotiation is requested, the request entity body must be preloaded using SSL preload. SSL preload will use the value of the UploadReadAheadSize metabase property, which is used for ISAPI extensions. However, if UploadReadAheadSize is smaller than the content length, an HTTP 413 error is returned, and the connection is closed to prevent deadlock. (Deadlock occurs because a client is waiting to complete sending a request entity, while the server is waiting for renegotiation to complete, but renegotiation requires that the client to be able to send data, which it cannot do).

The solution is to ensure that client is not blocked from sending the entire entity body. To do so, change the value of UploadReadAheadSize to a value larger than the content length.

The following example shows how to set the value for UploadReadAheadSize to 200KB on the Web server.
--------------------------------------

Morty
Hi,

We have an application outside the firewall who talks to a webservice
inside the firewall. 9 times of 10 this works, but sometimes we got
the error "The underlying connection was closed: An unexpected error
occurred on a receive." We have tested some of the solutions that we
have found in this discussion group but the problem still exist. We
use .NET Framework 1.1. The application server use Win2003. The
webservice server use Win2003. A temporary solution that we use now,
is to let the application do a retry when the webservice throw an
error. This works, but we don't like this solution.

Please help!
Fredrik


Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

26 posts views Thread by Rajeev Tipnis | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.