6.64Collaboration with DelegatingHandler
Created on Aug 17, 2026~1 min read
When you create an HttpClient via services.AddHttpClient(), .NET provides you with a HttpClientHandler by default as the "endpoint" of the pipeline. All DelegatingHandler instances added through .AddHttpMessageHandler<T>() are wrapped outside the HttpClientHandler, forming the following call chain:
CustomHandler3 → CustomHandler2 → CustomHandler1 → HttpClientHandler → NetworkThat is to say:
- Requests start from the outermost
DelegatingHandlerand are passed inward layer by layer; - Responses return from
HttpClientHandlerand are passed back outward layer by layer; HttpClientHandleris the only component that actually issues network requests.