Pergunta

I am getting the following error while I am reading an remote xml file to convert currency on HttpWebRequest.GetResponse() section.

the method that I used TugberkUgurlu_CurConverter.ConverterClass.ConvertActionForTL() is reading an xml file and get a currency value.

but suddenly, I started getting these errors. how can I prevent them? thanks !

System.Net.WebException: The operation has timed out Generated: Mon, 28 Mar 2011 19:33:48 GMT

System.Net.WebException: The operation has timed out at System.Net.HttpWebRequest.GetResponse() at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials) at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver) at System.Threading.CompressedStack.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state) at System.Xml.XmlTextReaderImpl.OpenUrl() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at TugberkUgurlu_CurConverter.ConverterClass.ConvertActionForTL(CurrencyForTLConvert SelectCurrency, Decimal YourPriceToConvert)

Foi útil?

Solução

I don't see any problems with the file you linked, and neither does XMLSpy.

You say it's a problem occasionally, and the file contains currency conversion values, which are likely to change frequently. Perhaps the file is occasionally bad?

Perhaps you should try loading the file as a text file first, and save it to disk. Then load the XmlDocument from the file on disk. That way, if it fails, you've still got the bad file to look at.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top