[Solved] How to update backup URL in app? Lets say for example Main URL is missing. How the back up url will accesible?

[ad_1]

Have you seen this package Polly

Polly is a .NET 3.5 / 4.0 / 4.5 / PCL library that allows developers to express transient exception handling policies such as Retry, Retry Forever, Wait and Retry or Circuit Breaker in a fluent manner.

You could use it to catch the WebException then retry or switch out the URL.

Here is an example from the blog post below:

In this example, we will try connecting to our service five times, with an exponential wait of 2, 4, 8, 16, and 32 seconds between tries. This should give the device a chance to reestablish its network connection and continue the request to the api.

conferences = await Policy  
  .Handle<WebException>()
  .WaitAndRetry
  (
    retryCount:5, 
    sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))
  )
  .ExecuteAsync(async () => await getConferencesTask);

Here is a blog post talking about Resilient network services with mobile Xamarin apps

[ad_2]

solved How to update backup URL in app? Lets say for example Main URL is missing. How the back up url will accesible?