'HttpClientFactory' does not exist in the current context
10,336
Install the Microsoft.AspNet.WebApi.Client nuget package.
VS -> Tools -> Nugetpackagemanager -> Package manager console
Install-Package Microsoft.AspNet.WebApi.Client
or (specific version)
Install-Package Microsoft.AspNet.WebApi.Client -Version 5.2.2
Author by
Anirban
Updated on June 18, 2022Comments
-
Anirban almost 2 years
I'm writing an application in C#. It pulls the data from Cloudant NoSQL DB.
But when I'm trying to create the Http client:
HttpClient client = HttpClientFactory.Create(new LoggingHandler());
the compiler throws error saying that
'HttpClientFactory' does not exist in the current context
I have also included:
using System.Net.Http;"
at the top.
I still cannot find where the error is.
Could someone please throw some light.
-
Donny V. over 7 yearsThis fixes the HttpClientFactory issue but usually your using other libraries that are brought over from installing the Microsoft.AspNet.WebApi.Client nuget package also.
-
Edza about 2 yearsWARNING! It is Microsoft.Extensions.Http :)
-
Fábio Rodrigues Fonseca about 2 yearsTk's @Edza Edited