อ่านในภาษาอังกฤษ

แชร์ผ่าน


HttpClientSocketHandlingExtensions.AddSocketsHttpHandler Method

Definition

Overloads

AddSocketsHttpHandler(IHttpClientBuilder)

Adds a delegate that will set SocketsHttpHandler as the primary HttpMessageHandler for a named Microsoft.Extensions.HttpClient.

AddSocketsHttpHandler(IHttpClientBuilder, Action<SocketsHttpHandlerBuilder>)

Adds a delegate that will set SocketsHttpHandler as the primary HttpMessageHandler for a named Microsoft.Extensions.HttpClient.

AddSocketsHttpHandler(IHttpClientBuilder)

Adds a delegate that will set SocketsHttpHandler as the primary HttpMessageHandler for a named Microsoft.Extensions.HttpClient.

C#
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddSocketsHttpHandler(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder);

Parameters

Returns

The given IHttpClientBuilder instance to allow method chaining.

Applies to

.NET 10 (package-provided) และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)

AddSocketsHttpHandler(IHttpClientBuilder, Action<SocketsHttpHandlerBuilder>)

Adds a delegate that will set SocketsHttpHandler as the primary HttpMessageHandler for a named Microsoft.Extensions.HttpClient.

C#
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddSocketsHttpHandler(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Action<Microsoft.Extensions.HttpClient.SocketHandling.SocketsHttpHandlerBuilder> configure);

Parameters

configure
Action<SocketsHttpHandlerBuilder>

Configure using a SocketsHttpHandlerBuilder instance.

Returns

The given IHttpClientBuilder instance to allow method chaining.

Applies to

.NET 10 (package-provided) และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)