2014-01-28 39 views
0

將XML呈現爲文本而不是格式化的RSS。網站部署在IIS7(Windows Server 2012)上。示例代碼如下:將XML呈現爲所有瀏覽器的RSS提要

<?xml version='1.0' encoding='utf-8'?> 
<rss version='2.0'> 
<channel> 
<title>Site Title</title> 
<link>http://iep036s:3648/Pages/TTV.aspx</link> 
<description>RSS feed for the Video list.</description> 
<lastBuildDate>Sat, 25 Jan 2014 20:31:01 GMT</lastBuildDate> 
<generator>Description</generator> 

<item> 
<title >Title</title> 
<link>http://iep036s:3648/Pages/Detail.aspx?Id=262</link> 
<description>Description</description> 
<pubDate>Wed, 16 May 2012 00:00:00 GMT</pubDate> 
<guid isPermaLink='true'>http://iep036s:3648/Pages/Detail.aspx?Id=261</guid> 
</item> 
</channel> 
</rss> 

回答

0

確保它從你的ISS服務器服務與正確的Content-Type頭:application/rss+xml

+0

我已經做了這個改變,現在它適用於IE。但Google Chrome和Firefox仍然存在同樣的問題(XML以文字形式呈現)。請注意,我不確定如何使用'Content-Type'頭文件:'text \ xml',這個相同的XML文件呈現爲格式化RSS(在IIS7 + Win Svr2008上)。 –