"HttpClientFactory" does not exist in the current context

I am writing an application in C #. It retrieves data from the Clouds NoSQL DB database.

But when I try to create an Http client:

HttpClient client = HttpClientFactory.Create(new LoggingHandler());

the compiler throws an error saying that

'HttpClientFactory' does not exist in the current context

I also included:

using System.Net.Http;"

up.

I still cannot find where the error is.

Maybe someone will shed some light.

+4
source share
3 answers

Install the Microsoft.AspNet.WebApi.Client nuget package .

VS -> Tools -> Nugetpackagemanager -> Package Manager Console

Microsoft.AspNet.WebApi.Client installation package

or (specific version)

Installation package Microsoft.AspNet.WebApi.Client -Version 5.2.2

+8

FYI ​​ :

System.Net.Http.Formatting
0

. , Microsoft.AspNet.WebApi.Client nuget, netcoreapp1.1 , ( nuget ). .NET Core 2. , .NET Core 1.x 2, : https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/

0

Source: https://habr.com/ru/post/1611973/


All Articles