HttpMessageHandlerBuilder.CreateHandlerPipeline Method

Definition

Constructs an instance of HttpMessageHandler by chaining additionalHandlers one after another with primaryHandler in the end of the chain. The resulting pipeline is used by IHttpClientFactory infrastructure to create HttpClient instances with customized message handlers. The resulting pipeline can also be accessed by using IHttpMessageHandlerFactory instead of IHttpClientFactory.

protected public:
 static System::Net::Http::HttpMessageHandler ^ CreateHandlerPipeline(System::Net::Http::HttpMessageHandler ^ primaryHandler, System::Collections::Generic::IEnumerable<System::Net::Http::DelegatingHandler ^> ^ additionalHandlers);
protected internal static System.Net.Http.HttpMessageHandler CreateHandlerPipeline (System.Net.Http.HttpMessageHandler primaryHandler, System.Collections.Generic.IEnumerable<System.Net.Http.DelegatingHandler> additionalHandlers);
static member CreateHandlerPipeline : System.Net.Http.HttpMessageHandler * seq<System.Net.Http.DelegatingHandler> -> System.Net.Http.HttpMessageHandler
Protected Friend Shared Function CreateHandlerPipeline (primaryHandler As HttpMessageHandler, additionalHandlers As IEnumerable(Of DelegatingHandler)) As HttpMessageHandler

Parameters

primaryHandler
HttpMessageHandler

An instance of HttpMessageHandler to operate at the bottom of the handler chain and actually handle the HTTP transport operations.

additionalHandlers
IEnumerable<DelegatingHandler>

An ordered list of DelegatingHandler instances to be invoked as part of sending an HttpRequestMessage and receiving an HttpResponseMessage. The handlers are invoked in a top-down fashion. That is, the first entry is invoked first for an outbound request message but last for an inbound response message.

Returns

The HTTP message handler chain.

Exceptions

primaryHandler or additionalHandlers is null.

additionalHandlers contains a null entry. -or- The DelegatingHandler.InnerHandler property must be null. DelegatingHandler instances provided to HttpMessageHandlerBuilder must not be reused or cached.

Applies to