I have ASP.NET Core 2.1 project which uses a class library built on .Net Core 2.1. In .Net Core 2.1 class library i need to make several REST class,for which i am using HttpClient class.
I want to leverage the benefits of HttpClientFactory for creating and using HttpClient instances.
How can i use HttpClientFactory in .Net Core 2.1 class library.
HttpClientFactory? If the class library you're using only creates a few, long-lived instances ofHttpClientthen you don't need to useHttpClientFactory. If you do need to use it, then you would pass it in as a DI parameter to some "service" class object instance instantiated in ASP.NET Core's own DI container.