示例#1
0
 static void Main(string[] args)
 {
     using (var ws = new ServiceReference1.GetCurrentlyBestPlayerSoapClient())
     {
         for (int i = 0; i < 10; i++)
         {
             Console.WriteLine(ws.Hockey());
             Console.WriteLine(Soccer());
         }
     }
 }
示例#2
0
 static string Soccer()
 {
     return(Policy.Handle <System.ServiceModel.FaultException>().
            Retry(38, (exeption, retries) => {
         System.Threading.Thread.Sleep(retries * 10002);
     }).
            Execute(() =>
     {
         using (var ws = new ServiceReference1.GetCurrentlyBestPlayerSoapClient())
         {
             return ws.Soccer();
         }
     }));
 }
示例#3
0
        static string BestSoccerPlayer()
        {
            int retries = 5;
            int sleepWhenFailBeforeRetry = 3000;

            while (retries > 0)
            {
                try
                {
                    using (var ws = new ServiceReference1.GetCurrentlyBestPlayerSoapClient())
                    {
                        return(ws.Soccer());
                    }
                }
                catch
                {
                    System.Threading.Thread.Sleep(sleepWhenFailBeforeRetry);
                    retries--;
                }
            }
            return("ERROR");
        }