Don't Wrap HttpClient in a using Block — Practical HTTP Communication in C# Business Apps (Creation Patterns, Timeouts, Retries) (archived 2026-07-27)
Creating a new C# HttpClient with using on every request exhausts sockets, but making it static means it stops following DNS changes. This article walks through the mechanics behind both problems and lays out the correct creation patterns with PooledConnectionLifetime and IHttpClientFactory, timeout design, and retries with Microsoft.Extensions.Http.Resilience, from the practical standpoint of a Windows business app. Archived version of https://comcomponent.com/en/blog/csharp-httpclient-practical-guide/, as published on 2026-07-27. The live article is maintained and may change after this date. First published 2026-07-07.
Authors
- Go Komura (ORCID: https://orcid.org/0009-0008-8895-8390)
Institutions
- Fujikura (United States) (US)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-07-27
- DOI
- https://doi.org/10.5281/zenodo.21614763
- Primary Topic
- Software System Performance and Reliability
- Type
- article
- Field-Weighted Citation Impact
- 0.00