IServiceCollection does not contain a defintion for AddHttpClient

Solution 1:

You need to install Microsoft.Extensions.Http from NuGet

Solution 2:

Aah, I have found the solution. I think services.AddHttpClient work with .net core 2.1. So I updated my .net core version to 2.1 and updated the microsoft packages to 2.1 and it starts working.