21 Calling remote APIs with IHttpClientFactory
This chapter covers
- Problems caused by using
HttpClient
incorrectly to call HTTP APIs - Using
IHttpClientFactory
to manageHttpClient
lifetimes - Encapsulating configuration and handling transient errors with
IHttpClientFactory
So far in this book we’ve focused on creating web pages and exposing APIs. Whether that’s customers browsing a Razor Pages application or client-side SPAs and mobile apps consuming your APIs, we’ve been writing the APIs for others to consume.
However, it’s very common for your application to interact with third-party services by consuming their APIs. For example, an e-commerce site needs to take payments, send email and SMS messages, and retrieve exchange rates from a third-party ...
Get ASP.NET Core in Action, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.