惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
V
Vulnerabilities – Threatpost
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
S
Secure Thoughts
Microsoft Azure Blog
Microsoft Azure Blog
Blog — PlanetScale
Blog — PlanetScale
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
Tailwind CSS Blog
S
SegmentFault 最新的问题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
云风的 BLOG
云风的 BLOG
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
AWS News Blog
AWS News Blog
美团技术团队
G
Google Developers Blog
宝玉的分享
宝玉的分享
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
I
InfoQ
小众软件
小众软件
Google DeepMind News
Google DeepMind News
P
Privacy & Cybersecurity Law Blog
Stack Overflow Blog
Stack Overflow Blog
Webroot Blog
Webroot Blog
D
DataBreaches.Net
IT之家
IT之家
PCI Perspectives
PCI Perspectives
人人都是产品经理
人人都是产品经理
Hacker News: Ask HN
Hacker News: Ask HN
L
LangChain Blog
SecWiki News
SecWiki News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cisco Blogs
T
Threatpost
P
Proofpoint News Feed
Y
Y Combinator Blog
Cloudbric
Cloudbric
T
Tor Project blog
量子位
博客园_首页
B
Blog
Hugging Face - Blog
Hugging Face - Blog
GbyAI
GbyAI
D
Darknet – Hacking Tools, Hacker News & Cyber Security

博客园 - lui

阿里云SSL证书到期(续期)图文教程 IIS7配置HTTPS+默认访问https路径 SQL将多行数据合并成一行【转】 arcgis 服务网页打开需要输入用户名和密码问题解决 Arcgis for js加载百度地图 android-studio-ide 安装到运行第一个helloword,坑记录 Hyper-V虚拟机联网设置 arcgis--arcmap导出点的X,Y坐标 mysql查看锁表与解锁 arcgis10.2怎么把地理坐标系转化为投影坐标系(平面,米制坐标) arcmap 10.2 从 WGS_1984 转 Beijing_1954 mysql 转换13位数字毫秒时间 【win10系统问题】远程桌面登录一次后,第二次登录看不到用户名和密码输入框 如何更改Arcmap里经纬度小数点后面的位数? 腾讯视频qlv格式转换MP4普通视频方法 kettle_Spoon 修改共享DB连接带汉字引发的错误 AutoCAD2015激活码和密钥 SQL获取本周,上周,本月,上月第一天和最后一天[注:本周从周一到周天] SQL语句 不足位数补0 java.net.ProtocolException: Server redirected too many times
c# winform 服务器提交了协议冲突. Section=ResponseStatusLine
lui · 2018-01-28 · via 博客园 - lui

【转】

最近在用.net写一个网络蜘蛛,发现对有的网站用HttpWebrequest抓取网页的时候会报错,捕获异常提示:"服务器提交了协议冲突 Section=ResponseStatusLine ”,改用WebClient也是同样问题,后来知道,WebClient是对HttpWebrequest进一步进行了封装。
最后终于找到问题根源:The  server  committed  a  protocol  violation.  Section=ResponseHeader  Detail=CR  must  be  followed  by  LF 微软没有容忍不符合RFC  822中的httpHeader必须以CRLF结束的规定的服务器响应。
通过修改配置文件解决:在app.config或config.Config , 文件在项目的bin\Debug目录下;(WinForm)或web.config(Web)文件里修改。

WinForm下的app.config文件中添加:

<system.net>
    <settings>
      <httpWebRequest useUnsafeHeaderParsing="true" />
    </settings>
  </system.net>

完整 app.config文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net> 
        <settings> 
               <httpWebRequest useUnsafeHeaderParsing="true" />
        </settings> 
    </system.net>
</configuration>


编译以后会在Debug下面自动创建一个 程序名.exe.config 的配置文件
希望大家能少走弯路,Good Luck~