WebClient vs HttpClient – thankplus – 博客频道 – CSDN.NET

Web­Client

 

 

Http­Client

 

 

 

 

Avail­able in older ver­sion of .NET

 

.NET 4.5 only. Cre­ated to sup­port the grow­ing need of the Web API REST calls

 

 

 

WinRT appli­ca­tions can­not use WebClient

 

Http­Client can be used with WinRT

 

 

 

Pro­vides progress report­ing for downloads.

 

No progress report­ing for downloads.

 

 

 

Does not reuse resolved DNS, configured-cookies.

 

Can resuse resolved DNS, cookie con­fig­u­ra­tion and other authentication.

 

 

 

You need to new up a Web­Client to make con­cur­rent request.

 

Sin­gle Http­Client can make con­cur­rent requests.

 

 

 

Thin layer over WebRe­quest and WebResponse

 

Thin layer over Http­We­bRe­quest and HttpWebResponse

 

 

 

Mock­ing and test­ing Web­Client is difficult

 

Mock­ing and test­ing Http­Client is easy

 

 

 

Sup­ports FTP.

 

No sup­port for FTP.

 

 

 

Both syn­chro­nous and Asyn­chro­nous meth­ods are avail­able for IO bound requests.

 

All IO bound meth­ods in HTTP­Client are asynchronous.

 

 

 

原文地址:http://blogs.k10world.com/technology/webclient-httpclient-consume-http-requests/

来源URL:http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece7631046893b4c4380146d96864968d4e414c4224603103ab6e07b604a57ce963c215afe170bf7a6613464587ef686ce8e49d8bc98232c9c6269304a891005d318b8cb37609670875b99fe47bcedac7484aea389991211dd52752bdeabdc0646&p=8b2a9711838911a058ee930c5859c4&newp=8b2a9714949909f01abd9b7e0e1189231610db2151d7d31f2e96c900cc26&user=baidu&fm=sc&query=c%23+webclient+httpclient&qid=bf97647c00685ae9&p1=5