I've noticed that one of web services, that I am using sometimes(usually at the first attempt) returns WebException "The remote name could not be resolved".
I've desided to include re-try code in my call and it made my application more reliable:
// I beleive that it's a good idea to re-try in case of "The remote name could not be resolved"
for (int i = 0; i < 3; i++)
{
try
{ //call web service
ds = ReadRssUrlAsDataSet(timeStart, url);
break;
}
catch (WebException exc)
{
if (exc.Message.Contains("The remote name could not be resolved"))
{ DebugHelper.TracedLine("Attempt " + i.ToString() + " failed." +exc.Message);
continue;//try 3 times
}
throw;
}
}
posted @ Monday, August 14, 2006 9:38 AM