HttpWebResponse.GetResponse(); The operation has timed-out
-
Hello! We run this code to get xml for an example from uri´s
try { HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(requestUriString); webRequest.Timeout = timeOut; HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); return new StreamReader(webResponse.GetResponseStream(), encoding); } catch(WebException e) { LogError(e); return null; }
We keep getting alot of "The operation has timed-out"-exceptions thrown. Is there something we are missing when we are setting up the webRequest object? For instance, should we set ReadWriteTimeout? /regards W -
Hello! We run this code to get xml for an example from uri´s
try { HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(requestUriString); webRequest.Timeout = timeOut; HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); return new StreamReader(webResponse.GetResponseStream(), encoding); } catch(WebException e) { LogError(e); return null; }
We keep getting alot of "The operation has timed-out"-exceptions thrown. Is there something we are missing when we are setting up the webRequest object? For instance, should we set ReadWriteTimeout? /regards WYou Are not getting the request from the site.It Will wait for some time. if it is not recieving the request for particular time it will throw this error. Check the link it May Help http://www.codeproject.com/Messages/3208439/Re-Post-an-HTTP-Request-from-one-WebServer-to-anot.aspx[^]
If It Helps Click It as Answer
-
Hello! We run this code to get xml for an example from uri´s
try { HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(requestUriString); webRequest.Timeout = timeOut; HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); return new StreamReader(webResponse.GetResponseStream(), encoding); } catch(WebException e) { LogError(e); return null; }
We keep getting alot of "The operation has timed-out"-exceptions thrown. Is there something we are missing when we are setting up the webRequest object? For instance, should we set ReadWriteTimeout? /regards WWhere you mentioned
webRequest.Method
Other than that the code seems to be alright. If still errors out, open a web browser, paste the requestUriString to the address bar and see if the page response is within the Timeout limit... :) Cheers:rose:Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
-
Where you mentioned
webRequest.Method
Other than that the code seems to be alright. If still errors out, open a web browser, paste the requestUriString to the address bar and see if the page response is within the Timeout limit... :) Cheers:rose:Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.