WebClient vs HttpClient

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/

你可能感兴趣的:(Web/Wap,开发技术)