[C #] WebClient performance optimization,

Source: Internet
Author: User

[C #] WebClient performance optimization,

By default, WebClient is for security and convenience, not for performance. Therefore, when you plan to perform a stress test, you will find that the WebClient is slow.

The performance of WebClient is poor mainly because:

1. It uses the proxy settings of IE by default, while the proxy settings of IE are 'autocheck' by default '. This means that each process automatically detects a proxy when using WebClient for the first time, which usually takes more than five seconds.

2. The WebClient follows an old spam setting "Only two concurrent connections can be initiated for each website"


Therefore, you can optimize the performance of the WebClient as follows:

1. WebClient. Proxy = null. Disable proxy.

2. ServicePointManager. DefaultConnectionLimit = 500;


In addition, ServicePointManager also has several attributes that may affect performance: Expect100Continue, UseNagleAlgorithm, and CheckCertificateRevocationList.


It is really troublesome to use WebClient.


Is there a simple class library like curl?



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.