The basic connection has been closed: Does the server submit an HTTP protocol conflict?

Source: Internet
Author: User

The basic connection has been closed: the server submitted an HTTP protocol conflict.

This usually happens when we use the. net http component to access some Internet URL resources.
However, it is found that it is okay to use WinHTTP encapsulation to read data and return normal results. However, it is always uncomfortable to use Com for hosted native components. But I don't know where the problem is? Feeling, it must be the same as the http implementation of. net.CodeBecause the reading of COM components is normal for the same URL (the com era has passed the test). However, not all URLs have similar faults, generally, some dynamic Asp.net pages are more likely to appear.

 

Recently I finally found out that Microsoft has a kb discussion:

Http://forums.microsoft.com/MSDN/ShowPost.aspx? Postid = 296969 & siteid = 1

 

Specifically, add
<Configuration>

......
<System.net>
<Settings>
<Httpwebrequest useunsafeheaderparsing = "true"/>
</Settings>
</System.net>
</Configuration>

It turns out that the HTTP protocol may not end with a CRLF, which is strictly implemented. net HTTP protocol components are captured, and the question is wrong. In fact, most HTTP protocol components in the com era can be ignored. To ignore the native components of. net, the above configuration overwrites the system's machine. config default settings.

Capital-based ICP filing

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.