PollyHttpClientBuilderExtensions.AddPolicyHandlerFromRegistry 方法

定义

重载

AddPolicyHandlerFromRegistry(IHttpClientBuilder, Func<IReadOnlyPolicyRegistry<String>,HttpRequestMessage,IAsyncPolicy<HttpResponseMessage>>)

添加 PolicyHttpMessageHandler,它将使用 IReadOnlyPolicyRegistry<TKey> 返回的策略将请求执行涵盖在内。

AddPolicyHandlerFromRegistry(IHttpClientBuilder, String)

添加 PolicyHttpMessageHandler,它将使用 IReadOnlyPolicyRegistry<TKey> 返回的策略将请求执行涵盖在内。

AddPolicyHandlerFromRegistry(IHttpClientBuilder, Func<IReadOnlyPolicyRegistry<String>,HttpRequestMessage,IAsyncPolicy<HttpResponseMessage>>)

添加 PolicyHttpMessageHandler,它将使用 IReadOnlyPolicyRegistry<TKey> 返回的策略将请求执行涵盖在内。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddPolicyHandlerFromRegistry(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, Func<Polly::Registry::IReadOnlyPolicyRegistry<System::String ^> ^, System::Net::Http::HttpRequestMessage ^, Polly::IAsyncPolicy<System::Net::Http::HttpResponseMessage ^> ^> ^ policySelector);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddPolicyHandlerFromRegistry (this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Func<Polly.Registry.IReadOnlyPolicyRegistry<string>,System.Net.Http.HttpRequestMessage,Polly.IAsyncPolicy<System.Net.Http.HttpResponseMessage>> policySelector);
static member AddPolicyHandlerFromRegistry : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * Func<Polly.Registry.IReadOnlyPolicyRegistry<string>, System.Net.Http.HttpRequestMessage, Polly.IAsyncPolicy<System.Net.Http.HttpResponseMessage>> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function AddPolicyHandlerFromRegistry (builder As IHttpClientBuilder, policySelector As Func(Of IReadOnlyPolicyRegistry(Of String), HttpRequestMessage, IAsyncPolicy(Of HttpResponseMessage))) As IHttpClientBuilder

参数

返回

可用于配置客户端的 IHttpClientBuilder

注解

有关配置策略的指导,请参阅 上的 PolicyHttpMessageHandler 说明。

适用于

AddPolicyHandlerFromRegistry(IHttpClientBuilder, String)

添加 PolicyHttpMessageHandler,它将使用 IReadOnlyPolicyRegistry<TKey> 返回的策略将请求执行涵盖在内。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddPolicyHandlerFromRegistry(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, System::String ^ policyKey);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddPolicyHandlerFromRegistry (this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, string policyKey);
static member AddPolicyHandlerFromRegistry : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * string -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function AddPolicyHandlerFromRegistry (builder As IHttpClientBuilder, policyKey As String) As IHttpClientBuilder

参数

policyKey
String

用于从 IReadOnlyPolicyRegistry<TKey> 解析策略的密钥。

返回

可用于配置客户端的 IHttpClientBuilder

注解

有关配置策略的指导,请参阅 上的 PolicyHttpMessageHandler 说明。

适用于