HttpClientBuilderExtensions.ConfigurePrimaryHttpMessageHandler HttpClientBuilderExtensions.ConfigurePrimaryHttpMessageHandler HttpClientBuilderExtensions.ConfigurePrimaryHttpMessageHandler Method

Definition

Overloads

ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<IServiceProvider,HttpMessageHandler>) ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<IServiceProvider,HttpMessageHandler>) ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<IServiceProvider,HttpMessageHandler>)

Adds a delegate that will be used to configure the primary HttpMessageHandler for a named HttpClient.

ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<HttpMessageHandler>) ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<HttpMessageHandler>) ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<HttpMessageHandler>)

Adds a delegate that will be used to configure the primary HttpMessageHandler for a named HttpClient.

ConfigurePrimaryHttpMessageHandler<THandler>(IHttpClientBuilder) ConfigurePrimaryHttpMessageHandler<THandler>(IHttpClientBuilder) ConfigurePrimaryHttpMessageHandler<THandler>(IHttpClientBuilder)

Configures the primary HttpMessageHandler from the dependency injection container for a named HttpClient.

ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<IServiceProvider,HttpMessageHandler>) ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<IServiceProvider,HttpMessageHandler>) ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<IServiceProvider,HttpMessageHandler>)

Adds a delegate that will be used to configure the primary HttpMessageHandler for a named HttpClient.

public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder ConfigurePrimaryHttpMessageHandler (this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Func<IServiceProvider,System.Net.Http.HttpMessageHandler> configureHandler);
static member ConfigurePrimaryHttpMessageHandler : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * Func<IServiceProvider, System.Net.Http.HttpMessageHandler> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function ConfigurePrimaryHttpMessageHandler (builder As IHttpClientBuilder, configureHandler As Func(Of IServiceProvider, HttpMessageHandler)) As IHttpClientBuilder

Parameters

configureHandler
Func<IServiceProvider,HttpMessageHandler>

A delegate that is used to create an HttpMessageHandler.

Returns

An IHttpClientBuilder that can be used to configure the client.

Remarks

The delegate should return a new instance of the message handler each time it is invoked.

The IServiceProvider argument provided to configureHandler will be a reference to a scoped service provider that shares the lifetime of the handler being constructed.

ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<HttpMessageHandler>) ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<HttpMessageHandler>) ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<HttpMessageHandler>)

Adds a delegate that will be used to configure the primary HttpMessageHandler for a named HttpClient.

public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder ConfigurePrimaryHttpMessageHandler (this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Func<System.Net.Http.HttpMessageHandler> configureHandler);
static member ConfigurePrimaryHttpMessageHandler : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * Func<System.Net.Http.HttpMessageHandler> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function ConfigurePrimaryHttpMessageHandler (builder As IHttpClientBuilder, configureHandler As Func(Of HttpMessageHandler)) As IHttpClientBuilder

Parameters

configureHandler
Func<HttpMessageHandler>

A delegate that is used to create an HttpMessageHandler.

Returns

An IHttpClientBuilder that can be used to configure the client.

Remarks

The delegate should return a new instance of the message handler each time it is invoked.

ConfigurePrimaryHttpMessageHandler<THandler>(IHttpClientBuilder) ConfigurePrimaryHttpMessageHandler<THandler>(IHttpClientBuilder) ConfigurePrimaryHttpMessageHandler<THandler>(IHttpClientBuilder)

Configures the primary HttpMessageHandler from the dependency injection container for a named HttpClient.

public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder ConfigurePrimaryHttpMessageHandler<THandler> (this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder) where THandler : System.Net.Http.HttpMessageHandler;
static member ConfigurePrimaryHttpMessageHandler : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Handler :> System.Net.Http.HttpMessageHandler)
<Extension()>
Public Function ConfigurePrimaryHttpMessageHandler(Of THandler As HttpMessageHandler) (builder As IHttpClientBuilder) As IHttpClientBuilder

Type Parameters

THandler

The type of the DelegatingHandler. The handler type must be registered as a transient service.

Parameters

Returns

An IHttpClientBuilder that can be used to configure the client.

Remarks

The THandler will be resolved from a scoped service provider that shares the lifetime of the handler being constructed.

Applies to