PollyHttpClientBuilderExtensions.AddPolicyHandlerFromRegistry 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
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
参数
- builder
- IHttpClientBuilder
- policySelector
- Func<IReadOnlyPolicyRegistry<String>,HttpRequestMessage,IAsyncPolicy<HttpResponseMessage>>
选择要应用到当前请求的 IAsyncPolicy`1。
返回
可用于配置客户端的 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
参数
- builder
- IHttpClientBuilder
- policyKey
- String
用于从 IReadOnlyPolicyRegistry<TKey> 解析策略的密钥。
返回
可用于配置客户端的 IHttpClientBuilder。
注解
有关配置策略的指导,请参阅 上的 PolicyHttpMessageHandler 说明。