HttpClientBuilderExtensions.ConfigurePrimaryHttpMessageHandler Metoda

Definicja

Przeciążenia

ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<IServiceProvider,HttpMessageHandler>)

Dodaje delegata, który zostanie użyty do skonfigurowania HttpMessageHandler elementu podstawowego dla nazwanego HttpClient .Adds a delegate that will be used to configure the primary HttpMessageHandler for a named HttpClient.

ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<HttpMessageHandler>)

Dodaje delegata, który zostanie użyty do skonfigurowania HttpMessageHandler elementu podstawowego dla nazwanego HttpClient .Adds a delegate that will be used to configure the primary HttpMessageHandler for a named HttpClient.

ConfigurePrimaryHttpMessageHandler<THandler>(IHttpClientBuilder)

Konfiguruje podstawowy HttpMessageHandler z kontenera iniekcji zależności dla nazwanego HttpClient .Configures the primary HttpMessageHandler from the dependency injection container for a named HttpClient.

ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<IServiceProvider,HttpMessageHandler>)

Dodaje delegata, który zostanie użyty do skonfigurowania HttpMessageHandler elementu podstawowego dla nazwanego HttpClient .Adds a delegate that will be used to configure the primary HttpMessageHandler for a named HttpClient.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ ConfigurePrimaryHttpMessageHandler(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, Func<IServiceProvider ^, System::Net::Http::HttpMessageHandler ^> ^ configureHandler);
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

Parametry

configureHandler
Func<IServiceProvider,HttpMessageHandler>

Delegat, który jest używany do tworzenia HttpMessageHandler .A delegate that is used to create an HttpMessageHandler.

Zwraca

IHttpClientBuilder

IHttpClientBuilder, Którego można użyć do skonfigurowania klienta.An IHttpClientBuilder that can be used to configure the client.

Uwagi

configureHandlerDelegat powinien zwrócić nowe wystąpienie programu obsługi komunikatów przy każdym wywołaniu.The configureHandler delegate should return a new instance of the message handler each time it is invoked.

IServiceProviderPodany argument configureHandler będzie odwołaniem do dostawcy usług w zakresie, który współużytkuje okres istnienia konstruowanej procedury obsługi.The IServiceProvider argument provided to configureHandler will be a reference to a scoped service provider that shares the lifetime of the handler being constructed.

Dotyczy

ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<HttpMessageHandler>)

Dodaje delegata, który zostanie użyty do skonfigurowania HttpMessageHandler elementu podstawowego dla nazwanego HttpClient .Adds a delegate that will be used to configure the primary HttpMessageHandler for a named HttpClient.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ ConfigurePrimaryHttpMessageHandler(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, Func<System::Net::Http::HttpMessageHandler ^> ^ configureHandler);
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

Parametry

configureHandler
Func<HttpMessageHandler>

Delegat, który jest używany do tworzenia HttpMessageHandler .A delegate that is used to create an HttpMessageHandler.

Zwraca

IHttpClientBuilder

IHttpClientBuilder, Którego można użyć do skonfigurowania klienta.An IHttpClientBuilder that can be used to configure the client.

Uwagi

configureHandlerDelegat powinien zwrócić nowe wystąpienie programu obsługi komunikatów przy każdym wywołaniu.The configureHandler delegate should return a new instance of the message handler each time it is invoked.

Dotyczy

ConfigurePrimaryHttpMessageHandler<THandler>(IHttpClientBuilder)

Konfiguruje podstawowy HttpMessageHandler z kontenera iniekcji zależności dla nazwanego HttpClient .Configures the primary HttpMessageHandler from the dependency injection container for a named HttpClient.

public:
generic <typename THandler>
 where THandler : System::Net::Http::HttpMessageHandler[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ ConfigurePrimaryHttpMessageHandler(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder);
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

Parametry typu

THandler

Typ DelegatingHandler .The type of the DelegatingHandler. Typ procedury obsługi musi być zarejestrowany jako usługa przejściowa.The handler type must be registered as a transient service.

Parametry

Zwraca

IHttpClientBuilder

IHttpClientBuilder, Którego można użyć do skonfigurowania klienta.An IHttpClientBuilder that can be used to configure the client.

Uwagi

THandlerZostanie on rozwiązany przez dostawcę usług w zakresie, który współużytkuje okres istnienia konstruowanej procedury obsługi.The THandler will be resolved from a scoped service provider that shares the lifetime of the handler being constructed.

Dotyczy