首页 > 编程技术 > csharp

HttpWebRequest出错.Section=ResponseHeader Detail=CR

发布时间:2020-6-25 11:48

服务器提交了协议冲突. Section=ResponseHeader Detail=CR 后面必须是 LF 

The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF

主体意思是微软没有容忍不符合RFC 822中的httpHeader必须以CRLF结束的规定的服务器响应。

一个解决方案是在application.config或web.config文件里加入

  <system.net>

    <settings>

      <httpWebRequest useUnsafeHeaderParsing="true" />

    </settings>

  </system.net>

允许系统容忍(tolerant)只以CR或LF结尾的hearder信息
标签:[!--infotagslink--]

您可能感兴趣的文章: