Quantcast
Channel: Active questions tagged retry-logic - Stack Overflow
Viewing all articles
Browse latest Browse all 950

Using .NET8, on a "HttpIOException: The response ended prematurely", how can I add retries with exponential backoff?

$
0
0

developing a .Net8 application and currently having a need to perform http request retries when the connection ended prematurely (see ResponseEnded here)...

I wonder if I can use resilience mechanism with Polly and/or Microsoft.Extensions.Http.Resilience ?

Does the resilience retry mechanism will work by default on that exceptional case ?Or it require custom policy or custom delegating handler to do so ?

Thank you

Program.cs

builder.Services.AddHttpClient()   .AddResilienceHandler("my-pipeline", b => {     b.AddRetry(new HttpRetryStrategyOptions()); // retry default policies    });

Viewing all articles
Browse latest Browse all 950

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>