Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to diagnose "the operation has timed out" HttpException
    primarykey
    data
    text
    <p>I am calling 5 external servers to retrieve XML-based data for each request for a particular webpage on my IIS 6 server. Present volume is between 3-5 incoming requests per second, meaning 15-20 outgoing requests per second.</p> <p>99% of the outgoing requests from my server (the client) to the external servers (the server) work OK but about 100-200 per day end up with a "The operation has timed out" exception.</p> <p>This suggests I have a resource problem on my server - some shortage of sockets, ports etc or a thread lock but the problem with this theory is that the failures are entirely random - there are not a number of requests in a row that all fail - and two of the external servers account for the majority of the failures.</p> <p>My question is how can I further diagnose these exceptions to determine if the problem is on my end (the client) or on the other end (the servers)?</p> <p>The volume of requests precludes putting an analyzer on the wire - it would be very difficult to capture these few exceptions. I have reset CONNECTIONS and THREADS in my machine.config and the basic code looks like:</p> <pre><code>Dim hRequest As HttpWebRequest Dim responseTime As String Dim objWatch As New Stopwatch Try ' calculate time it takes to process transaction objWatch.Start() hRequest = System.Net.WebRequest.Create(url) ' set some defaults hRequest.Timeout = 5000 hRequest.ReadWriteTimeout = 10000 hRequest.KeepAlive = False ' to prevent open HTTP connection leak hRequest.SendChunked = False hRequest.AllowAutoRedirect = True hRequest.MaximumAutomaticRedirections = 3 hRequest.Accept = "text/xml" hRequest.Proxy = Nothing 'do not waste time searching for a proxy hRequest.ServicePoint.Expect100Continue = False Dim feed As New XDocument() ' use *Using* to auto close connections Using hResponse As HttpWebResponse = DirectCast(hRequest.GetResponse(), HttpWebResponse) Using reader As XmlReader = XmlReader.Create(hResponse.GetResponseStream()) feed = XDocument.Load(reader) reader.Close() End Using hResponse.Close() End Using objWatch.Stop() ' Work here with returned contents in "feed" document Return XXX' some results here Catch ex As Exception objWatch.Stop() hRequest.Abort() Return Nothing End Try </code></pre> <p>Any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload