<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/stop-ignoring-api-failures-use-polly-yl0lvctow" -->

---
title: Stop ignoring API failures. Use Polly | daily.dev
description: A hands-on tutorial demonstrates adding Polly resilience handling to an ASP.NET Core Web API's HttpClient pipeline via the Microsoft.Extensions.Http.Resilience...
canonical: https://daily.dev/posts/stop-ignoring-api-failures-use-polly-yl0lvctow
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Stop ignoring API failures. Use Polly | daily.dev
og:description: A hands-on tutorial demonstrates adding Polly resilience handling to an ASP.NET Core Web API's HttpClient pipeline via the Microsoft.Extensions.Http.Resilience...
og:url: https://daily.dev/posts/stop-ignoring-api-failures-use-polly-yl0lvctow
og:image: https://api.daily.dev/og/posts/YL0lVctOw.png
og:image:alt: Stop ignoring API failures. Use Polly
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Stop ignoring API failures. Use Polly

**[Round The Code](https://daily.dev/sources/roundthecode)** · 7 min read · 0 upvotes · 0 comments

## Summary

A hands-on tutorial demonstrates adding Polly resilience handling to an ASP.NET Core Web API's HttpClient pipeline via the Microsoft.Extensions.Http.Resilience NuGet package. It covers configuring retries with constant, exponential, and linear backoff, adding jitter to spread load, setting up circuit breakers with failure ratio and sampling duration thresholds, adding timeouts to prevent hanging requests, targeting retries to specific transient status codes like 500 and 504, and wiring up logging callbacks for retries, circuit breaker state changes, and timeouts.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.roundthecode.com/dotnet-tutorials/stop-ignoring-api-failures-use-polly>

## Questions this post answers

### How do I configure a circuit breaker with Polly in ASP.NET Core?

Use AddCircuitBreaker with HttpCircuitBreakerStrategyOptions inside AddResilienceHandler on your HttpClient registration. Set FailureRatio (e.g. 0.5) to define the failure percentage that trips the breaker, SamplingDuration as the measurement window, MinimumThroughput for the minimum request count, and BreakDuration for how long the circuit stays open before allowing a test request through.

_Developers wiring up fault-tolerant HttpClient pipelines can track .NET resilience patterns like this on daily.dev._

### What is the difference between exponential and linear backoff in Polly retries?

Exponential backoff doubles the delay on every retry attempt, so a 2-second base delay becomes 2, 4, then 8 seconds, giving a struggling downstream service progressively more recovery time. Linear backoff instead adds a fixed increment each time, producing 2, 4, then 6 seconds, offering a steadier growth without the long waits exponential backoff produces at higher attempt counts.

_Anyone tuning retry strategies for downstream API calls can keep comparisons like this handy via daily.dev._

### Why should I use jitter with Polly retries instead of a fixed delay?

Jitter prevents multiple clients from retrying a struggling server at exactly the same moment by adding a small random delay to each retry attempt, spreading load out instead of causing synchronized request spikes. When UseJitter is enabled in Polly's HttpRetryStrategyOptions, the Delay property no longer needs to be set since Polly randomizes the interval automatically.

_Engineers hardening API clients against thundering-herd retries can follow resilience techniques like this on daily.dev._

## Similar posts on daily.dev

- [Building Resilient APIs with the Retry Pattern](https://daily.dev/posts/building-resilient-apis-with-the-retry-pattern-nml75zabn) · Telerik · 0 upvotes · 0 comments
- [HttpClient Resilience in .NET 10: Timeout, Retry, and Circuit Breaker with Microsoft.Extensions.Http.Resilience](https://daily.dev/posts/httpclient-resilience-in-net-10-timeout-retry-and-circuit-breaker-with-microsoft-extensions-http-aszonhwdy) · We Are .NET · 5 upvotes · 0 comments
- [Microsoft.Data.SqlClient Retry Logic: Building Resilient .NET SQL Server Applications](https://daily.dev/posts/microsoft-data-sqlclient-retry-logic-building-resilient-net-sql-server-applications-juctob1p1) · C\# Corner · 2 upvotes · 1 comments
- [Try the new SqlClient and Retry connections natively](https://daily.dev/posts/try-the-new-sqlclient-and-retry-connections-natively-kfk0fzksr) · DevBlogs · 4 upvotes · 0 comments

---

Tags: [#aspnet](https://daily.dev/tags/aspnet)

[View this post on daily.dev](https://daily.dev/posts/stop-ignoring-api-failures-use-polly-yl0lvctow)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Stop ignoring API failures. Use Polly","url":"https://daily.dev/posts/stop-ignoring-api-failures-use-polly-yl0lvctow","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/stop-ignoring-api-failures-use-polly-yl0lvctow"},"datePublished":"2026-10-04T13:07:45.525Z","dateModified":"2026-10-04T13:17:45.440Z","description":"A hands-on tutorial demonstrates adding Polly resilience handling to an ASP.NET Core Web API's HttpClient pipeline via the Microsoft.Extensions.Http.Resilience...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/00b5c399b12b62555d4aa5734c749ae0?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/00b5c399b12b62555d4aa5734c749ae0?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Round The Code","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Round The Code","logo":"https://media.daily.dev/image/upload/s--HmwWBSI1--/f_auto,q_auto/v1791119052/logos/roundthecode?_a=BAMAMicg0","url":"https://daily.dev/sources/roundthecode"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/stop-ignoring-api-failures-use-polly-yl0lvctow","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"aspnet","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Round The Code","item":"https://daily.dev/sources/roundthecode"},{"@type":"ListItem","position":3,"name":"Stop ignoring API failures. Use Polly"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/stop-ignoring-api-failures-use-polly-yl0lvctow#faq","mainEntity":[{"@type":"Question","name":"How do I configure a circuit breaker with Polly in ASP.NET Core?","acceptedAnswer":{"@type":"Answer","text":"Use AddCircuitBreaker with HttpCircuitBreakerStrategyOptions inside AddResilienceHandler on your HttpClient registration. Set FailureRatio (e.g. 0.5) to define the failure percentage that trips the breaker, SamplingDuration as the measurement window, MinimumThroughput for the minimum request count, and BreakDuration for how long the circuit stays open before allowing a test request through. Developers wiring up fault-tolerant HttpClient pipelines can track .NET resilience patterns like this on daily.dev."}},{"@type":"Question","name":"What is the difference between exponential and linear backoff in Polly retries?","acceptedAnswer":{"@type":"Answer","text":"Exponential backoff doubles the delay on every retry attempt, so a 2-second base delay becomes 2, 4, then 8 seconds, giving a struggling downstream service progressively more recovery time. Linear backoff instead adds a fixed increment each time, producing 2, 4, then 6 seconds, offering a steadier growth without the long waits exponential backoff produces at higher attempt counts. Anyone tuning retry strategies for downstream API calls can keep comparisons like this handy via daily.dev."}},{"@type":"Question","name":"Why should I use jitter with Polly retries instead of a fixed delay?","acceptedAnswer":{"@type":"Answer","text":"Jitter prevents multiple clients from retrying a struggling server at exactly the same moment by adding a small random delay to each retry attempt, spreading load out instead of causing synchronized request spikes. When UseJitter is enabled in Polly's HttpRetryStrategyOptions, the Delay property no longer needs to be set since Polly randomizes the interval automatically. Engineers hardening API clients against thundering-herd retries can follow resilience techniques like this on daily.dev."}}]}
```

