WebClient default is for security and convenience, not for performance. So, when you're going to do stress tests, you'll find that WebClient is slow.
WebClient performance is poor, the main reasons are:
1, it lacks the capital to use IE proxy settings, and IE proxy settings by default is ' Auto detect '. This means that each process automatically detects the agent when it first uses WebClient, which often takes more than 5 seconds.
2, WebClient followed an old garbage setting "up to two concurrent connections per site"
Therefore, you can optimize the performance of WebClient as follows:
1, Webclient.proxy = NULL, prohibit it from using Proxy
2, servicepointmanager.defaultconnectionlimit = 500;
In addition, ServicePointManager also has several properties that may affect performance: Expect100continue, Usenaglealgorithm, checkcertificaterevocationlist
WebClient is really troublesome to use.
Is there a simple class library like curl?
[C #] WebClient performance optimization