Let's Talk HTTP in .NET Core
summary
Explains that IHttpClientFactory (built into .NET Core 2.1) centralizes configuration, gives named and typed clients, and refreshes handler chains by default every two minutes to avoid stale DNS while preventing socket exhaustion caused by creating/disposing HttpClient (Windows TIME_WAIT ≈ 240s, ~16k ephemeral ports). Shows how to attach delegating handlers, wire Polly policies for retries/timeouts/circuit-breakers, use streaming JSON to avoid large string allocations, and notes the new managed SocketsHttpHandler and HTTP/2 gRPC support.
AI-written summary · about
chapters (28)
- 0:00Introduction
- 0:54Agenda
- 2:10Code
- 2:49HTTP Client
- 5:37HTTP Client Demo
- 5:55HTTP Client Reuse
- 6:45Register HTTP Client
- 7:38Downside of HTTP
- 8:36HTTP Client Factory
- 10:57HTTP Client Refresh
- 11:51Named Clients
- 12:20Named Client
- 14:02Type 2 Clients
- 17:14outgoing middleware
- 17:32handler chain
- 17:44other handlers
- 18:36Handlers
- 19:37HTTP Client Instance
- 20:14Poly
- 22:09Handling Response Content
- 23:18Handling Errors
- 23:57Cancellation
- 25:13When
- 28:10Sockets HTTP Handler
- 29:34NET Core 30
- 31:49Summary
- 33:06Thank you
- 33:20Questions
