2012-10-09 58 views
0

我試圖解析RSS源並將它們顯示在我的網站上。解析techcrunch & arstechnica RSS時,我的代碼似乎正常工作。但是當我嘗試解析HackerNews RSS時,我收到了一個錯誤。解析RSS時出錯

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

我得到以下錯誤上的ReadXml = XmlReader.Create(的GetURL()); geturl是rss的網址。


服務器犯了違反協議。第= ResponseStatusLine


爲什麼我會在得到上面的錯誤的任何建議。 感謝

+0

可能的重複:http://stackoverflow.com/questions/11674938/the-server-committed-a-protocol-violation-section-responsestatusline-when-using http://stackoverflow.com /問題/ 2482715 /所述服務器提交的-A-協議違反截面-responsestatusline誤差 – sergserg

回答

0

檢查此鏈接:

The server committed a protocol violation. Section=ResponseStatusLine

1)您可以在Web配置文件中添加以下<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