# HttpClient Factory

The built-in way to create and configure HttpClient instances safely.

## What is **HttpClient Factory**?

The **HttpClient factory** (`AddHttpClient`) creates and manages `HttpClient` instances correctly, avoiding exhausted connections and stale DNS, and lets you configure each client in one place.

```csharp
builder.Services.AddHttpClient<WeatherClient>(c => c.BaseAddress = new Uri("https://api.weather.example.com"));
```

Level: Journeyman · [More ASP.NET Core terms at this level](https://www.ask-codey.com/glossary?category=aspnet-core&level=3)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/httpclient-factory
