![]() |
VOOZH | about |
dotnet add package Microsoft.Extensions.Http.Resilience --version 10.7.0
NuGet\Install-Package Microsoft.Extensions.Http.Resilience -Version 10.7.0
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="10.7.0" />
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="10.7.0" />Directory.Packages.props
<PackageReference Include="Microsoft.Extensions.Http.Resilience" />Project file
paket add Microsoft.Extensions.Http.Resilience --version 10.7.0
#r "nuget: Microsoft.Extensions.Http.Resilience, 10.7.0"
#:package Microsoft.Extensions.Http.Resilience@10.7.0
#addin nuget:?package=Microsoft.Extensions.Http.Resilience&version=10.7.0Install as a Cake Addin
#tool nuget:?package=Microsoft.Extensions.Http.Resilience&version=10.7.0Install as a Cake Tool
Resilience mechanisms for HttpClient built on the Polly framework.
From the command-line:
dotnet add package Microsoft.Extensions.Http.Resilience
Or directly in the C# project file:
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="[CURRENTVERSION]" />
</ItemGroup>
When configuring an HttpClient through the HTTP client factory the following extensions can add a set of pre-configured hedging or resilience behaviors. These pipelines combine multiple resilience strategies with pre-configured defaults.
The standard resilience pipeline makes use of the above strategies to ensure HTTP requests can be sent reliably.
var clientBuilder = services.AddHttpClient("MyClient");
clientBuilder.AddStandardResilienceHandler().Configure(o =>
{
o.CircuitBreaker.MinimumThroughput = 10;
});
The standard hedging pipeline uses a pool of circuit breakers to ensure that unhealthy endpoints are not hedged against. By default, the selection from pool is based on the URL Authority (scheme + host + port). It is recommended that you configure the way the strategies are selected by calling the SelectPipelineByAuthority() extensions. The last three strategies are applied to each individual endpoint.
var clientBuilder = services.AddHttpClient("MyClient");
clientBuilder.AddStandardHedgingHandler().Configure(o =>
{
o.TotalRequestTimeout.Timeout = TimeSpan.FromSeconds(10);
});
For more granular control a custom pipeline can be constructed.
var clientBuilder = services.AddHttpClient("MyClient");
clientBuilder.AddResilienceHandler("myHandler", b =>
{
b.AddFallback(new FallbackStrategyOptions<HttpResponseMessage>()
{
FallbackAction = _ => Outcome.FromResultAsValueTask(new HttpResponseMessage(HttpStatusCode.ServiceUnavailable))
})
.AddConcurrencyLimiter(100)
.AddRetry(new HttpRetryStrategyOptions())
.AddCircuitBreaker(new HttpCircuitBreakerStrategyOptions())
.AddTimeout(new HttpTimeoutStrategyOptions());
});
The following sections detail various known issues.
Grpc.Net.ClientFactory packageIf you're using Grpc.Net.ClientFactory version 2.63.0 or earlier, then enabling the standard resilience or hedging handlers for a gRPC client could cause a runtime exception. Specifically, consider the following code sample:
services
.AddGrpcClient<Greeter.GreeterClient>()
.AddStandardResilienceHandler();
The preceding code results in the following exception:
System.InvalidOperationException: The ConfigureHttpClient method is not supported when creating gRPC clients. Unable to create client with name 'GreeterClient'.
To resolve this issue, we recommend upgrading to Grpc.Net.ClientFactory version 2.64.0 or later.
There's a build time check that verifies if you're using Grpc.Net.ClientFactory version 2.63.0 or earlier, and if you are the check produces a compilation warning. You can suppress the warning by setting the following property in your project file:
<PropertyGroup>
<SuppressCheckGrpcNetClientFactoryVersion>true</SuppressCheckGrpcNetClientFactoryVersion>
</PropertyGroup>
If you're using .NET Application Insights version 2.22.0 or lower, then enabling resilience functionality in your application could cause all Application Insights telemetry to be missing. The issue occurs when resilience functionality is registered before Application Insights services. Consider the following sample causing the issue:
// At first, we register resilience functionality.
services.AddHttpClient().AddStandardResilienceHandler();
// And then we register Application Insights. As a result, Application Insights doesn't work.
services.AddApplicationInsightsTelemetry();
The issue can be fixed by updating .NET Application Insights to version 2.23.0 or higher. If you cannot update it, then registering Application Insights services before resilience functionality, as shown below, will fix the issue:
// We register Application Insights first, and now it will be working correctly.
services.AddApplicationInsightsTelemetry();
services.AddHttpClient().AddStandardResilienceHandler();
We welcome feedback and contributions in our GitHub repo.
| 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 is compatible. 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 is compatible. 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 is compatible. 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 is compatible. 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.Resilience:
| Package | Downloads |
|---|---|
|
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services. |
|
|
Duende.AccessTokenManagement
Automatic access token management for OAuth client credential flows |
|
|
OpenIddict.Client.SystemNetHttp
System.Net.Http integration package for the OpenIddict client services. |
|
|
Aspire.Hosting.Testing
Testing support for the Aspire application model. |
|
|
Indice.Services
Package Description |
Showing the top 20 popular GitHub repositories that depend on Microsoft.Extensions.Http.Resilience:
| Repository | Stars |
|---|---|
|
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
|
|
|
dotnet/maui
.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
|
|
|
jasontaylordev/CleanArchitecture
Clean Architecture Solution Template for ASP.NET Core
|
|
|
ardalis/CleanArchitecture
Clean Architecture Solution Template: A proven Clean Architecture Template for ASP.NET Core 10
|
|
|
App-vNext/Polly
Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. From version 6.0.1, Polly targets .NET Standard 1.1 and 2.0+.
|
|
|
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
|
|
|
dotnet/orleans
Cloud Native application framework for .NET
|
|
|
dotnet/eShop
A reference .NET application implementing an eCommerce site
|
|
|
dodyg/practical-aspnetcore
Practical samples of ASP.NET Core 11, 10, 9, 8.0, 7.0, 6.0, 5.0, 3.1, 2.2, and 2.1,projects you can use. Readme contains explanations on all projects.
|
|
|
OrchardCMS/OrchardCore
Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
|
|
|
elsa-workflows/elsa-core
The Workflow Engine for .NET
|
|
|
fullstackhero/dotnet-starter-kit
Production Grade Cloud-Ready .NET 10 Starter Kit (Web API + React Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
|
|
|
microsoft/aspire
Aspire is the tool for code-first, extensible, observable dev and deploy.
|
|
|
ChilliCream/graphql-platform
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Nitro the awesome Monaco based GraphQL IDE.
|
|
|
openiddict/openiddict-core
Flexible and versatile OAuth 2.0/OpenID Connect stack for .NET
|
|
|
microsoft/fluentui-blazor
Microsoft Fluent UI Blazor components library. For use with ASP.NET Core Blazor applications
|
|
|
thomhurst/TUnit
A modern, fast and flexible .NET testing framework
|
|
|
dotnet/samples
Sample code referenced by the .NET documentation
|
|
|
oskardudycz/EventSourcing.NetCore
Examples and Tutorials of Event Sourcing in .NET
|
|
|
dotnet/maui-samples
Samples for .NET Multi-Platform App UI (.NET MAUI)
|
| Version | Downloads | Last Updated |
|---|---|---|
| 10.7.0 | 296,918 | 6/9/2026 |
| 10.6.0 | 2,180,267 | 5/12/2026 |
| 10.5.0 | 3,629,101 | 4/15/2026 |
| 10.4.0 | 3,540,325 | 3/10/2026 |
| 10.3.0 | 3,821,043 | 2/10/2026 |
| 10.2.0 | 3,806,340 | 1/13/2026 |
| 10.1.0 | 4,443,884 | 12/9/2025 |
| 10.0.0 | 7,098,344 | 11/11/2025 |
| 9.10.0 | 5,035,768 | 10/14/2025 |
| 9.9.0 | 4,782,718 | 9/9/2025 |
| 9.8.0 | 2,196,373 | 8/12/2025 |
| 9.7.0 | 3,691,570 | 7/8/2025 |
| 9.6.0 | 3,039,717 | 6/10/2025 |
| 9.5.0 | 2,607,348 | 5/13/2025 |
| 9.4.0 | 3,732,968 | 4/8/2025 |
| 9.3.0 | 2,054,143 | 3/11/2025 |
| 9.2.0 | 3,695,585 | 2/11/2025 |
| 9.1.0 | 2,301,903 | 1/14/2025 |
| 9.0.0 | 6,908,205 | 11/12/2024 |
| 8.10.0 | 13,337,145 | 10/8/2024 |