Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.
Guide · Web DevelopmentFree

Polly documentation

The official docs for Polly, the .NET resilience library behind Microsoft.Extensions.Http.Resilience. Covers retry, circuit breaker, timeout, fallback, hedging and rate limiter strategies in Polly v8, with pipelines, telemetry and testing. Free and open source.

Latest version

8.8.0 (Polly.Core)

NuGet · Oct 2026

GitHub stars

14.2k (App-vNext/Polly)

GitHub · Oct 2026

Licence

BSD-3-Clause

GitHub · Oct 2026

Format

Guide

Topic

Web Development

Provider

App vNext

Time needed

A weekend

Level

Intermediate

Access

Free

What Polly is

Polly is the most widely used resilience library in .NET. It lets you wrap calls that can fail, such as HTTP requests to a payment gateway, an SMS provider or a partner API, in strategies that retry, time out, stop calling a failing service for a while, or return a fallback value. Microsoft's Microsoft.Extensions.Http.Resilience package, introduced with .NET 8, is built on Polly v8, so AddStandardResilienceHandler() in an ASP.NET Core app is Polly under the hood.

What the documentation covers

  • Strategies: retry with backoff and jitter, circuit breaker, timeout, fallback, hedging (sending a second request when the first is slow) and rate limiter, each with its options and examples.
  • Resilience pipelines: combining strategies in the right order, building them with ResiliencePipelineBuilder, and registering them with dependency injection.
  • Fault handling: deciding which results and exceptions a strategy should handle.
  • Telemetry: the events and metrics Polly emits, so retries and open circuits show up in your logs and dashboards.
  • Testing and migration: testing code that uses pipelines, and a guide for moving from the older v7 policy API to v8.

Is it worth your time?

Yes, if your API calls anything else over the network. Most production incidents that spread across services start with one slow dependency and no timeouts. Understanding what retries, timeouts and circuit breakers actually do, and when retries are dangerous, is expected of experienced .NET developers. You will also meet v7-style Policy.Handle<...>() code in older projects, and the migration guide explains it.

How to learn it

Read the introduction and the pages for retry, timeout and circuit breaker first. Then read Microsoft's HTTP resilience article and look at the defaults AddStandardResilienceHandler applies. Build a small client that calls a deliberately flaky endpoint and watch what each strategy does in your logs. Read the fallback and hedging pages when you need them.

Prerequisites

C#, async/await and HttpClient through IHttpClientFactory.

Free or paid?

Free and open source under the BSD 3-Clause licence.

What you can do after it

Add retries, timeouts, circuit breakers and fallbacks to outgoing calls, explain the defaults of the standard resilience handler, and avoid retrying calls that are not safe to repeat, such as payments.

csharpbackendopen source

Ready to start?

Opens on App vNext in a new tab.

Open resource
Link broken or out of date?

Report a problem

With "Polly documentation". Only Tauseef reads this.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.