This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
What is the recommended approach for implementing HttpClient in an app with long-lived clients?
HttpClient
Create a new instance of HttpClient for each request.
Use clients created by IHttpClientFactory.
IHttpClientFactory
Create a static or singleton instance using the HttpClient class and set PooledConnectionLifetime.
static
PooledConnectionLifetime
What is the purpose of IHttpClientFactory in an ASP.NET Core app?
To handle the creation and disposal of REST operations
To handle the creation and disposal of HTTP requests
To handle the creation and disposal of HTTP clients
What is the purpose of the PooledConnectionLifetime property in the HttpClient class in .NET Core?
To limit the lifetime of the connection, forcing a DNS lookup when the connection is replaced.
To allow the HttpClient to track time to live (TTL) durations specified by the DNS server.
To provide a central location for naming and configuring logical HttpClient instances.
You must answer all questions before checking your work.
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?