Microsoft.Extensions.Http.Polly 10.0.0-rc.2.25502.107
About
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.
[!NOTE] This package is deprecated. Please use either
Microsoft.Extensions.ResilienceorMicrosoft.Extensions.Http.Resilienceinstead.
How to Use
To use Microsoft.Extensions.Http.Polly, follow these steps:
Installation
dotnet add package Microsoft.Extensions.Http.Polly
Usage
Handle transient faults
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.
Dynamically select policies
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.
Main Types
The main types provided by this package are:
PollyHttpClientBuilderExtensions: Provides extension methods for configuringPolicyHttpMessageHandlermessage handlers as part of anHttpClientmessage handler pipelinePolicyHttpMessageHandler: ADelegatingHandlerimplementation that executes request processing surrounded by aPolly.PolicyPollyServiceCollectionExtensions: Provides convenience extension methods to registerPolly.Registry.IPolicyRegistry<string>andPolly.Registry.IReadOnlyPolicyRegistry<string>in a service collectionHttpRequestMessageExtensions: Provides extension methods forHttpRequestMessagePolly integration
Additional Documentation
For additional documentation and examples, refer to the official documentation on using Polly-based handlers in ASP.NET Core.
Feedback & Contributing
Microsoft.Extensions.Http.Polly is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Showing the top 20 packages that depend on Microsoft.Extensions.Http.Polly.
| Packages | Downloads |
|---|---|
|
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
|
61 |
|
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
|
59 |
|
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
|
57 |
|
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
|
56 |
|
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
|
55 |
|
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
|
54 |
|
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
|
53 |
|
Microsoft.Extensions.Http.Resilience
Resilience mechanisms for HTTP Client.
|
53 |
|
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
|
52 |
|
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
|
51 |
.NET Standard 2.0
- Microsoft.Extensions.Http (>= 10.0.0-rc.2.25502.107)
- Polly (>= 7.2.4)
- Polly.Extensions.Http (>= 3.0.0)
| Version | Downloads | Last updated |
|---|---|---|
| 10.0.0-rc.2.25502.107 | 4 | 10/15/2025 |
| 10.0.0-rc.1.25451.107 | 3 | 09/11/2025 |
| 10.0.0-preview.7.25380.108 | 11 | 08/15/2025 |
| 10.0.0-preview.6.25358.103 | 13 | 07/17/2025 |
| 10.0.0-preview.5.25277.114 | 13 | 06/10/2025 |
| 10.0.0-preview.4.25258.110 | 20 | 05/17/2025 |
| 10.0.0-preview.3.25172.1 | 20 | 04/11/2025 |
| 10.0.0-preview.2.25164.1 | 23 | 03/21/2025 |
| 10.0.0-preview.1.25120.3 | 24 | 02/26/2025 |
| 9.0.10 | 2 | 10/15/2025 |
| 9.0.9 | 6 | 09/12/2025 |
| 9.0.8 | 12 | 08/05/2025 |
| 9.0.7 | 12 | 07/12/2025 |
| 9.0.6 | 13 | 06/14/2025 |
| 9.0.5 | 24 | 05/17/2025 |
| 9.0.4 | 23 | 04/13/2025 |
| 9.0.3 | 23 | 03/13/2025 |
| 9.0.2 | 27 | 02/14/2025 |
| 9.0.1 | 27 | 01/18/2025 |
| 9.0.0 | 36 | 11/13/2024 |
| 9.0.0-rc.2.24474.3 | 33 | 10/13/2024 |
| 9.0.0-rc.1.24452.1 | 36 | 09/16/2024 |
| 9.0.0-preview.7.24406.2 | 37 | 08/13/2024 |
| 9.0.0-preview.6.24328.4 | 42 | 07/15/2024 |
| 9.0.0-preview.5.24306.11 | 38 | 06/15/2024 |
| 9.0.0-preview.4.24267.6 | 36 | 05/23/2024 |
| 9.0.0-preview.3.24172.13 | 38 | 04/13/2024 |
| 9.0.0-preview.2.24128.4 | 48 | 03/21/2024 |
| 9.0.0-preview.1.24081.5 | 40 | 02/17/2024 |
| 8.0.21 | 3 | 10/15/2025 |
| 8.0.20 | 3 | 09/11/2025 |
| 8.0.19 | 11 | 08/05/2025 |
| 8.0.18 | 13 | 07/10/2025 |
| 8.0.17 | 11 | 06/14/2025 |
| 8.0.16 | 22 | 05/16/2025 |
| 8.0.15 | 23 | 04/11/2025 |
| 8.0.14 | 25 | 03/13/2025 |
| 8.0.13 | 27 | 02/26/2025 |
| 8.0.12 | 29 | 01/23/2025 |
| 8.0.11 | 34 | 11/13/2024 |
| 8.0.10 | 36 | 10/13/2024 |
| 8.0.8 | 41 | 08/13/2024 |
| 8.0.7 | 40 | 07/10/2024 |
| 8.0.6 | 39 | 05/30/2024 |
| 8.0.5 | 46 | 05/22/2024 |
| 8.0.4 | 43 | 04/11/2024 |
| 8.0.3 | 42 | 03/20/2024 |
| 8.0.2 | 45 | 02/16/2024 |
| 8.0.1 | 46 | 01/20/2024 |
| 8.0.0 | 61 | 11/17/2023 |
| 8.0.0-rc.2.23480.2 | 47 | 10/16/2023 |
| 8.0.0-rc.1.23421.29 | 44 | 09/14/2023 |
| 8.0.0-preview.7.23375.9 | 47 | 08/31/2023 |
| 8.0.0-preview.6.23329.11 | 51 | 08/31/2023 |
| 8.0.0-preview.5.23302.2 | 46 | 08/31/2023 |
| 8.0.0-preview.4.23260.4 | 49 | 08/31/2023 |
| 8.0.0-preview.3.23177.8 | 47 | 09/01/2023 |
| 8.0.0-preview.2.23153.2 | 44 | 09/01/2023 |
| 8.0.0-preview.1.23112.2 | 45 | 09/01/2023 |
| 7.0.20 | 49 | 05/30/2024 |
| 7.0.19 | 47 | 05/22/2024 |
| 7.0.18 | 46 | 04/11/2024 |
| 7.0.17 | 49 | 03/20/2024 |
| 7.0.16 | 43 | 02/16/2024 |
| 7.0.15 | 52 | 02/03/2024 |
| 7.0.14 | 54 | 11/17/2023 |
| 7.0.13 | 42 | 10/25/2023 |
| 7.0.12 | 57 | 10/12/2023 |
| 7.0.11 | 50 | 09/13/2023 |
| 7.0.10 | 52 | 08/30/2023 |
| 7.0.9 | 53 | 08/30/2023 |
| 7.0.8 | 50 | 08/30/2023 |
| 7.0.7 | 47 | 08/30/2023 |
| 7.0.5 | 44 | 08/30/2023 |
| 7.0.4 | 53 | 08/30/2023 |
| 7.0.3 | 55 | 08/30/2023 |
| 7.0.2 | 54 | 08/30/2023 |
| 7.0.1 | 47 | 08/30/2023 |
| 7.0.0 | 48 | 08/30/2023 |
| 7.0.0-rc.2.22476.2 | 46 | 08/31/2023 |
| 7.0.0-rc.1.22427.2 | 49 | 09/01/2023 |
| 7.0.0-preview.7.22376.6 | 47 | 08/31/2023 |
| 7.0.0-preview.6.22330.3 | 50 | 09/01/2023 |
| 7.0.0-preview.5.22303.8 | 51 | 08/31/2023 |
| 7.0.0-preview.4.22251.1 | 44 | 08/31/2023 |
| 7.0.0-preview.3.22178.4 | 44 | 09/01/2023 |
| 7.0.0-preview.2.22153.2 | 54 | 09/01/2023 |
| 7.0.0-preview.1.22109.13 | 45 | 09/01/2023 |
| 6.0.36 | 34 | 11/13/2024 |
| 6.0.35 | 36 | 10/12/2024 |
| 6.0.33 | 42 | 08/13/2024 |
| 6.0.32 | 37 | 07/15/2024 |
| 6.0.31 | 34 | 05/30/2024 |
| 6.0.30 | 51 | 05/22/2024 |
| 6.0.29 | 40 | 04/11/2024 |
| 6.0.28 | 40 | 03/20/2024 |
| 6.0.27 | 54 | 02/16/2024 |
| 6.0.26 | 43 | 02/03/2024 |
| 6.0.25 | 48 | 11/17/2023 |
| 6.0.24 | 48 | 10/25/2023 |
| 6.0.23 | 46 | 10/12/2023 |
| 6.0.22 | 47 | 09/13/2023 |
| 6.0.21 | 49 | 08/30/2023 |
| 6.0.20 | 48 | 08/30/2023 |
| 6.0.19 | 46 | 08/30/2023 |
| 6.0.18 | 40 | 08/30/2023 |
| 6.0.16 | 47 | 08/30/2023 |
| 6.0.15 | 52 | 08/30/2023 |
| 6.0.14 | 43 | 08/30/2023 |
| 6.0.13 | 44 | 08/30/2023 |
| 6.0.12 | 43 | 08/30/2023 |
| 6.0.11 | 46 | 08/30/2023 |
| 6.0.10 | 43 | 08/30/2023 |
| 6.0.9 | 45 | 08/30/2023 |
| 6.0.8 | 56 | 08/30/2023 |
| 6.0.7 | 53 | 08/30/2023 |
| 6.0.6 | 49 | 08/30/2023 |
| 6.0.5 | 42 | 08/30/2023 |
| 6.0.4 | 47 | 08/30/2023 |
| 6.0.3 | 50 | 08/30/2023 |
| 6.0.2 | 56 | 08/30/2023 |
| 6.0.1 | 45 | 08/29/2023 |
| 6.0.0 | 49 | 08/30/2023 |
| 6.0.0-rc.2.21480.10 | 46 | 08/31/2023 |
| 6.0.0-rc.1.21452.15 | 41 | 09/01/2023 |
| 6.0.0-preview.7.21378.6 | 45 | 09/16/2023 |
| 6.0.0-preview.6.21355.2 | 45 | 08/31/2023 |
| 6.0.0-preview.5.21301.17 | 43 | 08/31/2023 |
| 6.0.0-preview.4.21253.5 | 38 | 09/01/2023 |
| 6.0.0-preview.3.21201.13 | 47 | 09/01/2023 |
| 6.0.0-preview.2.21154.6 | 44 | 08/31/2023 |
| 6.0.0-preview.1.21103.6 | 44 | 08/31/2023 |
| 5.0.1 | 45 | 08/30/2023 |
| 5.0.0 | 45 | 08/30/2023 |
| 5.0.0-rc.2.20478.4 | 40 | 08/31/2023 |
| 5.0.0-rc.1.20451.7 | 41 | 09/18/2023 |
| 5.0.0-preview.8.20407.3 | 50 | 08/31/2023 |
| 5.0.0-preview.7.20365.4 | 44 | 08/31/2023 |
| 5.0.0-preview.6.20306.1 | 45 | 09/01/2023 |
| 5.0.0-preview.5.20278.3 | 48 | 08/31/2023 |
| 5.0.0-preview.4.20251.2 | 47 | 08/31/2023 |
| 5.0.0-preview.3.20215.2 | 42 | 09/01/2023 |
| 5.0.0-preview.2.20160.3 | 45 | 09/01/2023 |
| 5.0.0-preview.1.20120.4 | 45 | 09/01/2023 |
| 3.1.32 | 46 | 08/30/2023 |
| 3.1.31 | 51 | 08/30/2023 |
| 3.1.30 | 48 | 08/30/2023 |
| 3.1.29 | 50 | 08/30/2023 |
| 3.1.28 | 43 | 08/30/2023 |
| 3.1.27 | 45 | 08/30/2023 |
| 3.1.26 | 48 | 08/30/2023 |
| 3.1.25 | 48 | 08/30/2023 |
| 3.1.24 | 44 | 08/30/2023 |
| 3.1.23 | 61 | 08/30/2023 |
| 3.1.22 | 46 | 08/30/2023 |
| 3.1.21 | 45 | 08/30/2023 |
| 3.1.20 | 45 | 08/30/2023 |
| 3.1.19 | 50 | 08/30/2023 |
| 3.1.18 | 44 | 08/30/2023 |
| 3.1.17 | 48 | 08/30/2023 |
| 3.1.16 | 47 | 08/30/2023 |
| 3.1.15 | 49 | 08/30/2023 |
| 3.1.14 | 41 | 08/30/2023 |
| 3.1.13 | 61 | 08/30/2023 |
| 3.1.12 | 52 | 08/30/2023 |
| 3.1.11 | 44 | 08/30/2023 |
| 3.1.10 | 43 | 08/30/2023 |
| 3.1.9 | 55 | 08/30/2023 |
| 3.1.8 | 42 | 08/30/2023 |
| 3.1.7 | 44 | 09/01/2023 |
| 3.1.6 | 52 | 08/30/2023 |
| 3.1.5 | 49 | 08/30/2023 |
| 3.1.4 | 48 | 08/30/2023 |
| 3.1.3 | 45 | 08/30/2023 |
| 3.1.2 | 50 | 08/30/2023 |
| 3.1.1 | 55 | 08/30/2023 |
| 3.1.0 | 45 | 08/30/2023 |
| 3.1.0-preview3.19553.2 | 46 | 08/31/2023 |
| 3.1.0-preview2.19525.4 | 43 | 09/01/2023 |
| 3.1.0-preview1.19506.1 | 41 | 09/01/2023 |
| 3.0.3 | 39 | 08/30/2023 |
| 3.0.2 | 41 | 08/30/2023 |
| 3.0.1 | 46 | 08/30/2023 |
| 3.0.0 | 41 | 08/30/2023 |
| 3.0.0-rc1.19456.10 | 47 | 09/01/2023 |
| 3.0.0-preview9.19423.4 | 53 | 08/31/2023 |
| 3.0.0-preview8.19405.4 | 42 | 09/01/2023 |
| 3.0.0-preview7.19362.4 | 50 | 09/01/2023 |
| 3.0.0-preview6.19304.6 | 45 | 09/01/2023 |
| 3.0.0-preview5.19227.9 | 51 | 09/01/2023 |
| 3.0.0-preview4.19216.2 | 50 | 09/01/2023 |
| 3.0.0-preview3.19153.1 | 42 | 09/01/2023 |
| 3.0.0-preview.19074.2 | 46 | 09/01/2023 |
| 3.0.0-preview.18572.1 | 44 | 09/01/2023 |
| 2.2.0 | 50 | 08/30/2023 |
| 2.2.0-preview3-35497 | 41 | 08/31/2023 |
| 2.2.0-preview2-35157 | 44 | 09/01/2023 |
| 2.2.0-preview1-35029 | 60 | 09/01/2023 |
| 2.1.1 | 50 | 08/30/2023 |
| 2.1.0 | 49 | 08/30/2023 |
| 2.1.0-rc1-final | 51 | 09/01/2023 |
| 2.1.0-preview2-final | 45 | 09/01/2023 |