![]() |
VOOZH | about |
dotnet add package Microsoft.Extensions.Http.Polly --version 10.0.9
NuGet\Install-Package Microsoft.Extensions.Http.Polly -Version 10.0.9
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="10.0.9" />Directory.Packages.props
<PackageReference Include="Microsoft.Extensions.Http.Polly" />Project file
paket add Microsoft.Extensions.Http.Polly --version 10.0.9
#r "nuget: Microsoft.Extensions.Http.Polly, 10.0.9"
#:package Microsoft.Extensions.Http.Polly@10.0.9
#addin nuget:?package=Microsoft.Extensions.Http.Polly&version=10.0.9Install as a Cake Addin
#tool nuget:?package=Microsoft.Extensions.Http.Polly&version=10.0.9Install as a Cake Tool
Microsoft.Extensions.Http.Polly integrates IHttpClientFactory with the Polly library to provide comprehensive resilience and transient fault-handling. It allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner.
This package is deprecated. Please use either Microsoft.Extensions.Resilience or Microsoft.Extensions.Http.Resilience instead.
To use Microsoft.Extensions.Http.Polly, follow these steps:
dotnet add package Microsoft.Extensions.Http.Polly
AddTransientHttpErrorPolicy can be used define a policy that handles transient errors:
builder.Services.AddHttpClient("PollyWaitAndRetry")
.AddTransientHttpErrorPolicy(policyBuilder =>
policyBuilder.WaitAndRetryAsync(
retryCount: 3,
retryNumber => TimeSpan.FromMilliseconds(600)));
In the preceding example, failed requests are retried up to three times with a delay of 600 ms between attempts.
To dynamically inspect a request and decide which policy apply, use the AddPolicyHandler extension method:
var timeoutPolicy = Policy.TimeoutAsync<HttpResponseMessage>(
TimeSpan.FromSeconds(10));
var longTimeoutPolicy = Policy.TimeoutAsync<HttpResponseMessage>(
TimeSpan.FromSeconds(30));
builder.Services.AddHttpClient("PollyDynamic")
.AddPolicyHandler(httpRequestMessage =>
httpRequestMessage.Method == HttpMethod.Get
? timeoutPolicy
: longTimeoutPolicy);
In this example, if the outgoing request is an HTTP GET, a 10-second timeout is applied. For any other HTTP method, a 30-second timeout is used.
The main types provided by this package are:
PollyHttpClientBuilderExtensions: Provides extension methods for configuring PolicyHttpMessageHandler message handlers as part of an HttpClient message handler pipelinePolicyHttpMessageHandler: A DelegatingHandler implementation that executes request processing surrounded by a Polly.PolicyPollyServiceCollectionExtensions: Provides convenience extension methods to register Polly.Registry.IPolicyRegistry<string> and Polly.Registry.IReadOnlyPolicyRegistry<string> in a service collectionHttpRequestMessageExtensions: Provides extension methods for HttpRequestMessage Polly integrationFor additional documentation and examples, refer to the official documentation on using Polly-based handlers in ASP.NET Core.
Microsoft.Extensions.Http.Polly is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Microsoft.Extensions.Http.Polly:
| Package | Downloads |
|---|---|
|
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services. |
|
|
OpenIddict.Client.SystemNetHttp
System.Net.Http integration package for the OpenIddict client services. |
|
|
Rystem.OpenAi
.Net wrapper for OpenAI with Dependency injection integration, factory integration: you may inject more than one endpoint, azure integration: you may swap among openai endpoint and any azure endpoint quickly and easily. You can calculate tokens and cost for each request (before the request) and for each response. You can access to the dashboard api to retrieve your current or previous billing. |
|
|
Rystem.RepositoryFramework.Api.Client
Rystem.RepositoryFramework allows you to use correctly concepts like repository pattern, CQRS and DDD. You have interfaces for your domains, auto-generated api, auto-generated HttpClient to simplify connection "api to front-end", a functionality for auto-population in memory of your models, a functionality to simulate exceptions and waiting time from external sources to improve your implementation/business test and load test. |
|
|
Omnia.Fx.NetCore
Package Description |
Showing the top 20 popular GitHub repositories that depend on Microsoft.Extensions.Http.Polly:
| Repository | Stars |
|---|---|
|
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
|
|
|
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
|
|
|
RayWangQvQ/BiliBiliToolPro
B 站(bilibili)自动任务工具,支持docker、青龙、k8s等多种部署方式。全面拥抱AI。敏感肌也能用。
|
|
|
LykosAI/StabilityMatrix
Multi-Platform Package Manager for Stable Diffusion
|
|
|
elsa-workflows/elsa-core
The Workflow Engine for .NET
|
|
|
anjoy8/Blog.Core
💖 ASP.NET Core 8.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
|
|
|
openiddict/openiddict-core
Flexible and versatile OAuth 2.0/OpenID Connect stack for .NET
|
|
|
Scighost/Starward
Game Launcher for miHoYo - 米家游戏启动器
|
|
|
Xabaril/AspNetCore.Diagnostics.HealthChecks
Enterprise HealthChecks for ASP.NET Core Diagnostics Package
|
|
|
fullstackhero/blazor-starter-kit
Clean Architecture Template for Blazor WebAssembly Built with MudBlazor Components.
|
|
|
dotnet/extensions
This repository contains a suite of libraries that provide facilities commonly needed when creating production-ready applications.
|
|
|
Cleanuparr/Cleanuparr
Advanced download manager for the Servarr ecosystem
|
|
|
Azure/azure-functions-host
The host/runtime that powers Azure Functions
|
|
|
microsoft/PowerApps-Samples
Sample code for Power Apps, including Dataverse, model-driven apps, canvas apps, Power Apps component framework, portals, and AI Builder.
|
|
|
NuGet/NuGetGallery
NuGet Gallery is a package repository that powers https://www.nuget.org. Use this repo for reporting NuGet.org issues.
|
|
|
rogerfar/rdt-client
Real-Debrid Client Proxy
|
|
|
AlphaYu/adnc
A pragmatic .NET 8 framework for modular monoliths to evolve seamlessly into distributed microservices.
|
|
|
meysamhadeli/booking-microservices
A practical microservices with the latest technologies and architectures like Vertical Slice Architecture, Event Sourcing, CQRS, DDD, gRpc, MongoDB, RabbitMq, Masstransit, and Aspire in .Net 10.
|
|
|
masastack/MASA.Blazor
Blazor UI component library based on Material Design. Support Blazor Server, Blazor WebAssembly and MAUI Blazor.
|
|
|
elevenyellow/handcrafted-persona-engine
An AI-powered interactive avatar engine using Live2D, LLM, ASR, TTS, and RVC. Ideal for VTubing, streaming, and virtual assistant applications.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.0-preview.5.26302.115 | 314 | 6/9/2026 |
| 11.0.0-preview.4.26230.115 | 5,136 | 5/12/2026 |
| 11.0.0-preview.3.26207.106 | 2,805 | 4/14/2026 |
| 11.0.0-preview.2.26159.112 | 3,964 | 3/10/2026 |
| 11.0.0-preview.1.26104.118 | 3,010 | 2/10/2026 |
| 10.0.9 | 222,708 | 6/9/2026 |
| 10.0.8 | 1,535,989 | 5/12/2026 |
| 10.0.7 | 2,625,951 | 4/21/2026 |
| 10.0.6 | 772,890 | 4/14/2026 |
| 10.0.5 | 3,293,955 | 3/12/2026 |
| 10.0.4 | 274,006 | 3/10/2026 |
| 9.0.17 | 13,192 | 6/9/2026 |
| 9.0.16 | 85,854 | 5/12/2026 |
| 9.0.15 | 263,927 | 4/14/2026 |
| 9.0.14 | 295,303 | 3/10/2026 |
| 9.0.13 | 415,846 | 2/10/2026 |
| 8.0.28 | 20,399 | 6/9/2026 |
| 8.0.27 | 137,325 | 5/12/2026 |
| 8.0.26 | 240,999 | 4/14/2026 |
| 8.0.25 | 372,855 | 3/10/2026 |