Skip to content

Instantly share code, notes, and snippets.

@ChaseFlorell ChaseFlorell/HttpRestService.cs Secret
Created Aug 13, 2014

What would you like to do?
GetAsync with Retry
public static async Task<HttpResponseMessage> GetWithRetriesAsync(string url,
AuthenticationHeaderValue authenticationHeaderValue,
MediaTypeWithQualityHeaderValue mediaTypeWithQualityHeaderValue)
var numberOfAttempts = 0;
AggregateException capturedException;
return await GetAsync(url, authenticationHeaderValue, mediaTypeWithQualityHeaderValue);
catch (AggregateException ex)
capturedException = ex;
} while (numberOfAttempts < TotalNumberOfAttempts);
throw capturedException;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.