Web Service Connection/Timeout problems in Dot .Net 1.1
Issue:
The underlying connection was closed: An unexpected error occurred on a receive.
Web Service Timeout problems occurring on Client and Server sides.
Server => Web Service Host
Client => Web Service Caller
*
The underlying connection was closed: An unexpected error occurred on a receive.
This is a client side problem.
And it can be solved by avoiding HTTP KeepAlives - with Dot Net 1.1
For other issues we need to increase the timeout values at various levels.
*
For Server side, adjust the proper connection timeout value in the IIS web server properties.
*
if the request takes too long on the server, the web server could time it out.
*
Also adjust this value: in the config file (web/app .config) (Read more on msdn)
The default is value 110, a little less than 2 minutes. See documentation for detail.
For Client Side (Timeout: 'give up on the server if you don't get a reply back with a certain time'.);
To specify the amount of time to wait for the request to complete, use the Timeout property.
A
Domain Name System (DNS) query may take up to 15 seconds to return or
time out. If your request contains a host name that requires resolution
and you set Timeout to a value less than 15 seconds, it may take 15
seconds or more before a WebException is thrown to indicate a timeout on your request.
*
There are two timeout values that need to be adjusted based on the situation.
Timeout, ReadWriteTimeout
*
HttpWebRequest.Timeout = The number of milliseconds to wait before the request times out. The default is 100,000 milliseconds (100 seconds).
*
HttpWebRequest.ReadWriteTimeout
= ReadWriteTimeout property controls the time-out for the Read method,
which is used to read the stream returned by the GetResponseStream
method, and for the Write method, which is used to write to the stream
returned by the GetRequestStream method.
Or simply 'The number of
milliseconds before the writing or reading times out. The default value
is 300,000 milliseconds (5 minutes).'
Adjust these values before calling the Web Service (Method) or before making the WebRequest.
*
WebClientProtocol.Timeout Property
The time out in milliseconds, for synchronous calls to the XML Web service. The default is 100000 milliseconds.
(WebClientProtocol: Specifies the base class for all XML Web service client proxies created using ASP.NET.)
Setting
the Timeout property to Timeout.Infinite indicates that the request
does not time out. Even though an XML Web service client can set the
Timeout property to not time out, the Web server can still cause the
request to time out on the server side.
Note that:
WebClientProtocol
->HttpWebClientProtocol
|->SoapHttpClientProtocol
|->WebServicesClientProtocol
|->WebServiceClass
These
properties of the WebClientRequest class and its derived classes all
map to properties on the corresponding System.Net.WebRequest and
derived classes.
*
I guess all this text above combined together would be helpful as it is described in a plain programmers way.
Further:
http://www.thescripts.com/forum/thread425852.html
http://www.thescripts.com/forum/thread427678.html
HttpWebRequest.ReadWriteTimeout Property
http://msdn2.microsoft.com/en-us/library/system.net.httpwebrequest.readwritetimeout.aspx
HttpWebRequest.Timeout Property
http://msdn2.microsoft.com/en-us/library/system.net.httpwebrequest.timeout.aspx
Please do not hesitate to ask/discuss it any further through your comments.
---
hB