httpClient (study notes 11)

First to a simple

 

 

 2, run nothing wrong

 

 

 3, see the TCP TIME_WAIT found

 

 

 4, run multiple times

 

 

 

 

5, the protagonist debut

 

 

After .Net Core2.1, Microsoft introduced HttpClientFactory solve this problem, the responsibility of the factory pattern is responsible for creating an object, this class is primarily responsible for creating the instance of HttpClient

First registered in StartUp, you may be prompted to install this package Nuget

 services.AddHttpClient();

Guess you like

Origin www.cnblogs.com/stonechina/p/12202070.html