Microsoft.Extensions.Http.Polly 11.0.0-rc.2.26504.105

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.Resilience or Microsoft.Extensions.Http.Resilience instead.

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 configuring PolicyHttpMessageHandler message handlers as part of an HttpClient message handler pipeline
  • PolicyHttpMessageHandler: A DelegatingHandler implementation that executes request processing surrounded by a Polly.Policy
  • PollyServiceCollectionExtensions: Provides convenience extension methods to register Polly.Registry.IPolicyRegistry<string> and Polly.Registry.IReadOnlyPolicyRegistry<string> in a service collection
  • HttpRequestMessageExtensions: Provides extension methods for HttpRequestMessage Polly 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.
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.
52
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
51
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
50
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
49
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
48
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
46
OpenIddict.Validation.SystemNetHttp
System.Net.Http integration package for the OpenIddict validation services.
45

.NET Standard 2.0

Version Downloads Last updated
11.0.0-rc.2.26504.105 5 10/13/2026
11.0.0-rc.1.26425.128 20 09/09/2026
11.0.0-preview.7.26381.103 21 08/12/2026
11.0.0-preview.6.26359.118 25 07/18/2026
11.0.0-preview.5.26302.115 27 06/11/2026
11.0.0-preview.4.26230.115 39 05/14/2026
11.0.0-preview.3.26207.106 43 04/17/2026
11.0.0-preview.2.26159.112 44 03/13/2026
11.0.0-preview.1.26104.118 34 02/11/2026
10.0.13 5 10/13/2026
10.0.12 16 09/09/2026
10.0.11 19 08/12/2026
10.0.10 26 07/16/2026
10.0.9 30 06/11/2026
10.0.8 26 05/14/2026
10.0.7 43 04/24/2026
10.0.6 34 04/16/2026
10.0.5 43 03/13/2026
10.0.4 43 03/13/2026
10.0.3 45 02/11/2026
10.0.2 47 01/15/2026
10.0.1 1 10/08/2026
10.0.0 34 12/14/2025
10.0.0-rc.2.25502.107 28 12/19/2025
10.0.0-rc.1.25451.107 28 12/11/2025
10.0.0-preview.7.25380.108 39 12/19/2025
10.0.0-preview.6.25358.103 40 12/11/2025
10.0.0-preview.5.25277.114 28 12/11/2025
10.0.0-preview.4.25258.110 39 12/11/2025
10.0.0-preview.3.25172.1 31 12/21/2025
10.0.0-preview.2.25164.1 43 12/14/2025
10.0.0-preview.1.25120.3 43 12/18/2025
9.0.21 4 10/14/2026
9.0.20 13 09/09/2026
9.0.19 17 08/12/2026
9.0.18 17 07/16/2026
9.0.17 25 06/11/2026
9.0.16 38 05/14/2026
9.0.15 47 04/16/2026
9.0.14 40 03/13/2026
9.0.13 41 02/11/2026
9.0.12 48 01/15/2026
9.0.11 34 12/14/2025
9.0.10 30 12/19/2025
9.0.9 47 12/14/2025
9.0.8 0 08/05/2025
9.0.7 48 12/11/2025
9.0.6 39 12/12/2025
9.0.5 44 12/25/2025
9.0.4 43 12/20/2025
9.0.3 43 12/23/2025
9.0.2 28 12/14/2025
9.0.1 34 12/11/2025
9.0.0 33 12/19/2025
9.0.0-rc.2.24474.3 29 12/11/2025
9.0.0-rc.1.24452.1 33 12/21/2025
9.0.0-preview.7.24406.2 42 12/14/2025
9.0.0-preview.6.24328.4 36 12/14/2025
9.0.0-preview.5.24306.11 25 12/15/2025
9.0.0-preview.4.24267.6 41 12/15/2025
9.0.0-preview.3.24172.13 26 12/22/2025
9.0.0-preview.2.24128.4 41 12/21/2025
9.0.0-preview.1.24081.5 36 12/21/2025
8.0.32 6 10/13/2026
8.0.31 16 09/09/2026
8.0.30 19 08/12/2026
8.0.29 23 07/21/2026
8.0.28 23 06/11/2026
8.0.27 40 05/14/2026
8.0.26 44 04/16/2026
8.0.25 41 03/13/2026
8.0.24 51 02/12/2026
8.0.23 44 01/15/2026
8.0.22 45 12/14/2025
8.0.21 27 12/19/2025
8.0.20 36 12/11/2025
8.0.19 29 12/12/2025
8.0.18 44 12/13/2025
8.0.17 42 12/14/2025
8.0.16 41 12/22/2025
8.0.15 37 12/14/2025
8.0.14 44 12/18/2025
8.0.13 44 12/22/2025
8.0.12 44 12/11/2025
8.0.11 39 12/20/2025
8.0.10 1 10/18/2026
8.0.8 40 12/21/2025
8.0.7 31 12/13/2025
8.0.6 41 12/11/2025
8.0.5 33 12/17/2025
8.0.4 38 12/21/2025
8.0.3 40 12/16/2025
8.0.2 36 12/16/2025
8.0.1 39 12/16/2025
8.0.0 36 12/24/2025
8.0.0-rc.2.23480.2 33 12/15/2025
8.0.0-rc.1.23421.29 37 12/21/2025
8.0.0-preview.7.23375.9 38 12/14/2025
8.0.0-preview.6.23329.11 30 12/21/2025
8.0.0-preview.5.23302.2 38 12/15/2025
8.0.0-preview.4.23260.4 29 12/21/2025
8.0.0-preview.3.23177.8 34 12/15/2025
8.0.0-preview.2.23153.2 34 12/13/2025
8.0.0-preview.1.23112.2 39 12/21/2025
7.0.20 37 12/17/2025
7.0.19 39 12/20/2025
7.0.18 45 12/21/2025
7.0.17 35 12/18/2025
7.0.16 29 12/20/2025
7.0.15 37 12/23/2025
7.0.14 35 12/22/2025
7.0.13 41 12/27/2025
7.0.12 41 12/29/2025
7.0.11 39 12/20/2025
7.0.10 38 12/23/2025
7.0.9 28 12/20/2025
7.0.8 39 12/15/2025
7.0.7 27 12/14/2025
7.0.5 43 12/14/2025
7.0.4 42 12/14/2025
7.0.3 36 12/14/2025
7.0.2 33 12/22/2025
7.0.1 29 12/15/2025
7.0.0 3 09/28/2026
7.0.0-rc.2.22476.2 28 12/19/2025
7.0.0-rc.1.22427.2 40 12/21/2025
7.0.0-preview.7.22376.6 38 12/14/2025
7.0.0-preview.6.22330.3 38 12/21/2025
7.0.0-preview.5.22303.8 1 10/10/2026
7.0.0-preview.4.22251.1 64 12/15/2025
7.0.0-preview.3.22178.4 36 12/18/2025
7.0.0-preview.2.22153.2 36 12/14/2025
7.0.0-preview.1.22109.13 38 12/14/2025
6.0.36 42 12/22/2025
6.0.35 40 12/11/2025
6.0.33 41 12/14/2025
6.0.32 34 12/14/2025
6.0.31 41 12/15/2025
6.0.30 39 12/14/2025
6.0.29 39 12/20/2025
6.0.28 35 12/14/2025
6.0.27 30 12/14/2025
6.0.26 37 12/22/2025
6.0.25 35 12/22/2025
6.0.24 37 12/17/2025
6.0.23 44 12/11/2025
6.0.22 38 12/20/2025
6.0.21 36 12/23/2025
6.0.20 29 12/20/2025
6.0.19 39 12/20/2025
6.0.18 43 12/17/2025
6.0.16 41 12/20/2025
6.0.15 39 12/20/2025
6.0.14 40 12/14/2025
6.0.13 39 12/24/2025
6.0.12 41 12/14/2025
6.0.11 38 12/21/2025
6.0.10 45 12/14/2025
6.0.9 25 12/21/2025
6.0.8 38 12/15/2025
6.0.7 41 12/19/2025
6.0.6 32 12/15/2025
6.0.5 43 12/24/2025
6.0.4 30 12/14/2025
6.0.3 39 12/21/2025
6.0.2 37 12/17/2025
6.0.1 31 12/15/2025
6.0.0 40 12/20/2025
6.0.0-rc.2.21480.10 37 12/21/2025
6.0.0-rc.1.21452.15 38 12/14/2025
6.0.0-preview.7.21378.6 25 01/16/2026
6.0.0-preview.6.21355.2 46 12/14/2025
6.0.0-preview.5.21301.17 44 12/11/2025
6.0.0-preview.4.21253.5 27 12/14/2025
6.0.0-preview.3.21201.13 29 12/21/2025
6.0.0-preview.2.21154.6 29 12/15/2025
6.0.0-preview.1.21103.6 36 12/21/2025
5.0.1 40 12/21/2025
5.0.0 25 12/18/2025
5.0.0-rc.2.20478.4 30 12/21/2025
5.0.0-rc.1.20451.7 39 12/15/2025
5.0.0-preview.8.20407.3 36 12/16/2025
5.0.0-preview.7.20365.4 31 12/21/2025
5.0.0-preview.6.20306.1 28 12/20/2025
5.0.0-preview.5.20278.3 41 12/21/2025
5.0.0-preview.4.20251.2 32 12/14/2025
5.0.0-preview.3.20215.2 39 12/15/2025
5.0.0-preview.2.20160.3 26 12/14/2025
5.0.0-preview.1.20120.4 37 12/15/2025
3.1.32 42 12/23/2025
3.1.31 41 12/16/2025
3.1.30 39 12/21/2025
3.1.29 40 12/14/2025
3.1.28 40 12/14/2025
3.1.27 41 12/11/2025
3.1.26 45 12/14/2025
3.1.25 39 12/22/2025
3.1.24 39 12/17/2025
3.1.23 39 12/21/2025
3.1.22 40 12/16/2025
3.1.21 41 12/21/2025
3.1.20 30 12/14/2025
3.1.19 36 12/12/2025
3.1.18 40 12/24/2025
3.1.17 27 12/19/2025
3.1.16 29 12/21/2025
3.1.15 40 12/21/2025
3.1.14 43 12/15/2025
3.1.13 33 12/21/2025
3.1.12 36 12/14/2025
3.1.11 32 12/17/2025
3.1.10 46 12/21/2025
3.1.9 40 12/12/2025
3.1.8 40 12/21/2025
3.1.7 40 12/18/2025
3.1.6 31 12/18/2025
3.1.5 40 12/14/2025
3.1.4 35 12/21/2025
3.1.3 35 12/11/2025
3.1.2 37 12/12/2025
3.1.1 43 12/15/2025
3.1.0 3 10/02/2026
3.1.0-preview3.19553.2 39 12/21/2025
3.1.0-preview2.19525.4 25 12/21/2025
3.1.0-preview1.19506.1 41 12/21/2025
3.0.3 41 12/23/2025
3.0.2 35 12/12/2025
3.0.1 29 12/15/2025
3.0.0 43 12/21/2025
3.0.0-rc1.19456.10 44 12/16/2025
3.0.0-preview9.19423.4 32 12/21/2025
3.0.0-preview8.19405.4 34 12/21/2025
3.0.0-preview7.19362.4 43 12/14/2025
3.0.0-preview6.19304.6 35 12/16/2025
3.0.0-preview5.19227.9 26 12/16/2025
3.0.0-preview4.19216.2 34 12/14/2025
3.0.0-preview3.19153.1 36 12/21/2025
3.0.0-preview.19074.2 34 12/15/2025
3.0.0-preview.18572.1 26 12/21/2025
2.2.0 46 12/11/2025
2.2.0-preview3-35497 40 12/21/2025
2.2.0-preview2-35157 35 12/14/2025
2.2.0-preview1-35029 38 12/23/2025
2.1.1 36 12/11/2025
2.1.0 27 12/12/2025
2.1.0-rc1-final 32 12/16/2025
2.1.0-preview2-final 28 12/13/2025