0

我有以下代码从博客子站点检索到最新帖子的链接:

XDocument doc = XDocument.Load("http://www.mysite.com/blog/syndication.axd");
XElement node = doc.Descendants("item").FirstOrDefault();
string text = node.Element("title").Value;
string uri = node.Element("link").Value;

代码总是运行良好。本周我通过 NuGet 添加了 ELMAH.MVC 作为包参考。一旦我使用添加的 ELMAH 部分部署 web.config 文件,就会收到以下错误:

System.Web.HttpException (0x80004005): Error executing child request for handler 
'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'. 
---> System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
   at System.Net.HttpWebRequest.GetResponse()
   at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
   at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
   at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
   at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)

如果我把旧的 web.config 文件放回去,错误就会消失。

知道为什么添加 ELMAH 会导致 XDocument.Load 失败吗?

4

1 回答 1

2

您需要查看您的 ASP.Net 站点并找到服务器端错误。

于 2012-11-01T21:36:54.350 回答