There are a lot of services need to pull API interface data, so the back-end development of Http access request is not encapsulated, the most important application way is to use WebClient for encapsulation, easy to use; HttpClient and HttpClientFactory are Microsoft’s official recommendations for.net Core. Do you have the same doubts as I do?

Post request code

Without exception handling, the amount of code looks similar, using the WebClient code as follows:

/ / object args
var postData = JsonConvert.SerializeObject(args);
var client = new WebClient {
    
Copy the code