Intermittent WebException "The remote name could not be resolved" -try a few times.

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;

                    }

                }

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted @ Monday, August 14, 2006 9:38 AM
Print

Comments on this entry:

# re: Intermittent WebException "The remote name could not be resolved" -try a few times.

Left by Zed power at 8/12/2011 12:57 PM
Gravatar
that's wone way. did you every resolve what was causing it?

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«February»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910