---
title: "How to implement a Retry policy with exponential backoff using Polly in .NET 8?"  
description: "How to implement a Retry policy with exponential backoff using Polly in .NET 8?"  
author: "Ravi Vishwakarma"  
published: 2026-08-14  
updated: 2026-08-14  
canonical: https://answers.mindstick.com/qa/117057/how-to-implement-a-retry-policy-with-exponential-backoff-using-polly-in-net-8  
category: "Polly"  
tags: ["csharp", "dotnet", "polly", "resilience", "microservices"]  
reading_time: 1 minute  

---

# How to implement a Retry policy with exponential backoff using Polly in .NET 8?

When building microservices or communicating with external APIs, transient network faults can cause temporary request failures. Implementing a retry strategy with exponential backoff helps mitigate these issues without overwhelming the downstream service.

## Using Polly v8 Resilience Pipeline

With Polly v8 and **Microsoft.Extensions.Resilience**, you can construct a resilient pipeline using the `ResiliencePipelineBuilder` class.

### Code Example

```cs
var pipeline = new ResiliencePipelineBuilder()
    .AddRetry(new RetryStrategyOptions
    {
        ShouldHandle = new PredicateBuilder().Handle<HttpRequestException>(),
        MaxRetryAttempts = 3,
        Delay = TimeSpan.FromSeconds(2),
        BackoffType = DelayBackoffType.Exponential,
        UseJitter = true
    })
    .Build();

await pipeline.ExecuteAsync(async cancellationToken =>
{
    // Perform HTTP operation here
    await MakeNetworkRequestAsync(cancellationToken);
});
```

### Key Considerations

- **Jitter:** Adding randomness prevents the thundering herd problem.
- **Transient Errors:** Only retry operations that are transient (e.g., HTTP 503 or network socket timeouts).


---

Original Source: https://answers.mindstick.com/qa/117057/how-to-implement-a-retry-policy-with-exponential-backoff-using-polly-in-net-8

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
