【发布时间】:2012-11-13 20:35:00
【问题描述】:
我有一个 aspx 页面,它提供像这样加载到 xslt 中的 xml:
<xsl:variable name="newsurl">http://mytesturl.dk/public/simpeldatalist.aspx?method=getnews</xsl:variable>
<xsl:variable name="news" select="msxsl:node-set(document($newsurl, /))"/>
,在我的开发服务器上运行良好。
移动到实时服务器,这不再起作用,而是像这样抛出:
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)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.Xsl.Runtime.XmlQueryContext.GetDataSource(String uriRelative, String uriBase)
--- End of inner exception stack trace ---
at System.Xml.Xsl.Runtime.XmlQueryContext.GetDataSource(String uriRelative, String uriBase)
at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator )
at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter) at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results) at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, Stream results) at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, Stream results)
at Dynamicweb.Base.XmlXsltParse(XmlDocument xmlDoc, XslCompiledTransform transformer, TextWriter tw, XsltArgumentList xmlargs)
实时服务器和开发服务器在浏览器中调用页面时显示相同的xml(目前为空):
<?xml version="1.0" encoding="utf-8"?>
<newsitems>
</newsitems>
在 live 上更改 xml 中的 url 以从测试服务器读取有效....所以:Live 和 dev 服务器可以从 dev 读取,但没有一个可以从 live 读取...
显然现场服务器有一些设置,不允许调用该庄园的页面。
有人能想到原因吗?一些安全设置?我不知道要提供哪些更多信息,所以请询问您是否发现缺少一些信息...
供稿:
不会在 xslt 中加载:http://www.osterbo.dk/public/simpeldatalist.aspx?method=rawxml&dbsqlforxml=getnews
将加载:http://osterbo.bleaudev.dk/public/simpeldatalist.aspx?method=rawxml&dbsqlforxml=getnews
问候,
斯蒂恩
【问题讨论】:
-
问题部分解决了......我发现使用这个方法:our.umbraco.org/forum/developers/xslt/… 解决了这个问题。但是,我不喜欢在通常不需要的时候在 xslts 中使用 C#。所以我仍然想弄清楚为什么该服务器要求发送标头......
-
Steen,我使用 MSXML3 和 MSXML4 获取了两个文档。我想这也是 MSXML6 的情况,但我需要设置一些命令行参数以允许执行
document()函数。希望这些信息对您有用。