Compartir a través de


HttpClientBuilderExtensions.UseSocketsHttpHandler Método

Definición

Sobrecargas

UseSocketsHttpHandler(IHttpClientBuilder, Action<ISocketsHttpHandlerBuilder>)

Agrega o actualiza SocketsHttpHandler como controlador principal para un denominado HttpClient y lo configura mediante ISocketsHttpHandlerBuilder.

UseSocketsHttpHandler(IHttpClientBuilder, Action<SocketsHttpHandler,IServiceProvider>)

Agrega o actualiza SocketsHttpHandler como controlador principal para un objeto denominado HttpClient. Si se proporciona, también agrega un delegado que se usará para configurar el servidor principal SocketsHttpHandler.

UseSocketsHttpHandler(IHttpClientBuilder, Action<ISocketsHttpHandlerBuilder>)

Source:
HttpClientBuilderExtensions.cs
Source:
HttpClientBuilderExtensions.cs
Source:
HttpClientBuilderExtensions.cs

Agrega o actualiza SocketsHttpHandler como controlador principal para un denominado HttpClient y lo configura mediante ISocketsHttpHandlerBuilder.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ UseSocketsHttpHandler(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, Action<Microsoft::Extensions::DependencyInjection::ISocketsHttpHandlerBuilder ^> ^ configureBuilder);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder UseSocketsHttpHandler (this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Action<Microsoft.Extensions.DependencyInjection.ISocketsHttpHandlerBuilder> configureBuilder);
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member UseSocketsHttpHandler : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * Action<Microsoft.Extensions.DependencyInjection.ISocketsHttpHandlerBuilder> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function UseSocketsHttpHandler (builder As IHttpClientBuilder, configureBuilder As Action(Of ISocketsHttpHandlerBuilder)) As IHttpClientBuilder

Parámetros

builder
IHttpClientBuilder

El parámetro de cadena de consulta IHttpClientBuilder.

configureBuilder
Action<ISocketsHttpHandlerBuilder>

Delegado que se usa para configurar la configuración del elemento principal SocketsHttpHandler en ISocketsHttpHandlerBuilder el que se aplicará más adelante en el controlador principal durante su creación.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Atributos

Comentarios

Si ya se estableció un controlador principal para que se SocketsHttpHandler llamara anteriormente, por ejemplo, ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<HttpMessageHandler>) o UseSocketsHttpHandler(IHttpClientBuilder, Action<ISocketsHttpHandlerBuilder>), el conjunto de configuración en ISocketsHttpHandlerBuilder se aplicará a la instancia existente. De lo contrario, se creará una nueva instancia de SocketsHttpHandler .

Se aplica a

UseSocketsHttpHandler(IHttpClientBuilder, Action<SocketsHttpHandler,IServiceProvider>)

Source:
HttpClientBuilderExtensions.cs
Source:
HttpClientBuilderExtensions.cs
Source:
HttpClientBuilderExtensions.cs
Source:
HttpClientBuilderExtensions.cs

Agrega o actualiza SocketsHttpHandler como controlador principal para un objeto denominado HttpClient. Si se proporciona, también agrega un delegado que se usará para configurar el servidor principal SocketsHttpHandler.

[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder UseSocketsHttpHandler (this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Action<System.Net.Http.SocketsHttpHandler,IServiceProvider>? configureHandler = default);
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member UseSocketsHttpHandler : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * Action<System.Net.Http.SocketsHttpHandler, IServiceProvider> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function UseSocketsHttpHandler (builder As IHttpClientBuilder, Optional configureHandler As Action(Of SocketsHttpHandler, IServiceProvider) = Nothing) As IHttpClientBuilder

Parámetros

builder
IHttpClientBuilder

El parámetro de cadena de consulta IHttpClientBuilder.

configureHandler
Action<SocketsHttpHandler,IServiceProvider>

Delegado opcional que se usa para configurar el principal SocketsHttpHandler.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Atributos

Comentarios

Si ya se estableció un controlador principal para que se SocketsHttpHandler llamara anteriormente, por ejemplo, ConfigurePrimaryHttpMessageHandler(IHttpClientBuilder, Func<HttpMessageHandler>) o UseSocketsHttpHandler(IHttpClientBuilder, Action<ISocketsHttpHandlerBuilder>), el delegado pasado configureHandler se aplicará a la instancia existente. De lo contrario, se creará una nueva instancia de SocketsHttpHandler .

Se aplica a