简体   繁体   中英

5 .NET HTTP libraries - where does Microsoft.Net.Http fit in?

I know of the following HTTP libraries:

  1. HttpWebRequest
  2. WebClient
  3. System.Net.Http.HttpClient
  4. Windows.Web.Http.HttpClient
  5. Microsoft.Net.Http

The first 3 are quite simple to place: WebClient vs HttpClient vs HttpWebRequest

The 4th is also not that complicated: Demystifying HttpClient APIs in the Universal Windows Platform

But where does Microsoft.Net.Http fit in?

So according to all the feedback and articles referenced so far:

  1. HttpWebRequest - original HTTP API. Provides low-level control.
  2. WebClient - layer of abstraction over HttpWebRequest. Simpler to use, slightly slower performance.
  3. System.Net.Http.HttpClient - Layer of abstraction over HttpWebRequest that provides more features than the previous two options. Up to version 4.0.0.0 it was just for full .NET, nut since version 4.1.0 supports .NET Core
  4. Windows.Web.Http.HttpClient - a consolidation of HTTP API's from multiple languages (C#, VB, C++, JavaScript). Mainly used for multi-language Windows Store App developed so that only one API needs to be referenced.
  5. Microsoft.Net.Http - HTTP API that replaces System.Net.Http.HttpClient 2.0.2 or older. This is used to support older .NET applications.

System.Net.Http vs Microsoft.Net.Http : Depends on the version. The old System.Net.Http packages (the 2.0 ones) are legacy packages which are deprecated in favor of Microsoft.Http.Net

So esentially 3 and 5 are the same. It's async http client that enables you to make asynchronous http requests and in comparison to WebClient it does work in multi-threaded environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM