Sometimes I am getting a time out exception when reading an XML via a URL. Is there something I can do to prevent this, or is this a problem with the remote server? Below is my simple code:
XmlDocument doc = new XmlDocument();
doc.Load(XmlReader.Create(this.RssUrl));
I cam across a post that says KeepAlive may help, but I do not know how to pass that setting into the code above (or if that is even the correct solution): http://www.velocityreviews.com/forums/t95843-system-webexception-the-operation-has-timed-out.html
This is the exception, please help!
Exception Details: System.Net.WebException: The operation has timed out
Stack Trace:
[WebException: The operation has timed out]
System.Net.HttpWebRequest.GetResponse() +5375213
System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials) +69
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +3929371
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +54
System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext) +144
System.Xml.XmlReader.Create(String inputUri) +8