Error when Parsing RSS

匿名 (未验证) 提交于 2019-12-03 01:45:01

问题:

I 'm trying to parse RSS feeds and then display them on my website. My code seems to work correctly when parsing techcrunch & arstechnica RSS. But when I try to parse HackerNews RSS I get the an error.

    XmlReader readXML;     readXML = XmlReader.Create(GetURL());     SyndicationFeed News= SyndicationFeed.Load(readXML);     readXML.Close();     return News; 

I get the following error on readXML = XmlReader.Create(GetURL()); geturl is the url for rss.


The server committed a protocol violation. Section=ResponseStatusLine


Any suggestions why I 'm getting the above error. Thanks

回答1:

Check this link:

The server committed a protocol violation. Section=ResponseStatusLine

1.) You can add the following <httpWebRequest useUnsafeHeaderParsing="true" /> in the Web Config file to solve the server committed a protocol violation

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

2.)

Attention to all web developers who are using Skype! Make sure to uncheck the option for using port 80 and 443 from Tools\Options\Connection dialog.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!