解析RSS时出错

时间:2012-10-09 13:47:27

标签: c# .net-3.5 rss

我正在尝试解析RSS Feed,然后在我的网站上显示它们。我的代码似乎在解析techcrunch& arstechnica RSS。但是当我尝试解析HackerNews RSS时,我得到了一个错误。

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

我在 readXML = XmlReader.Create(GetURL())上遇到以下错误; geturl是rss的网址。


  

服务器提交了协议违规。节= ResponseStatusLine


为什么我收到上述错误的任何建议。 感谢

1 个答案:

答案 0 :(得分:0)

检查此链接:

The server committed a protocol violation. Section=ResponseStatusLine

1。)您可以在Web Config文件中添加以下<httpWebRequest useUnsafeHeaderParsing="true" />以解决服务器提交的协议违规行为

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

2)。

关注所有使用Skype的网络开发者!确保从Tools \ Options \ Connection对话框中取消选中使用端口80和443的选项。

enter image description here