3.31Setting the HttpClient instance name (multiple base addresses)

Created on Aug 17, 2026~1 min read

By default, the system uses IHttpClientFactory to create HttpClient instances and sets the default client name to an empty string (string.Empty). You can specify the client name used when creating the HttpClient instance.

cs
HttpRequestBuilder.Get("https://furion.net/")    .SetHttpClientName(string.Empty); // Use the default client (usually no need to set it explicitly)HttpRequestBuilder.Get("https://furion.net/")    .SetHttpClientName("weixin"); // Specify the client named "weixin"

You can also provide configuration for a named HttpClient client in the Startup.cs or Program.cs file:

cs
// Configure the default client (whose name is an empty string)services.AddHttpClient(string.Empty, client => { });// Configure the client named "weixin"services.AddHttpClient("weixin", client => { });