CrossDomain错误 [英] CrossDomain error
问题描述
我在IIS中托管了我的Silverlight应用程序,现在当我尝试访问应用程序时,我收到以下错误
I have hosted my Silverlight application in IIS, now when I try to access the application I get the following error
System.ServiceModel .CommunicationException:
尝试向URI发出请求时发生错误这可能是由于尝试
以跨域方式访问服务,而没有适当的跨域
策略,或不适合SOAP服务的策略.....
System.ServiceModel.CommunicationException: an error occured while trying to make request to URI This could be due to attempting to access a service in a cross-domain way without proper cross-domain policy in place, or policy that is unsuitable for SOAP services.....
我已将跨域策略正确放置在wwwroot以及在虚拟目录中。
I have placed the cross-domain policy properly in wwwroot as well as in the virtual directory.
<?xml version="1.0"?>
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
推荐答案
如果您不需要与Flash兼容使用安全策略,请尝试使用Silverlight特定的clientaccesspolicy.xml并查看是否收到相同的错误。查看 Tim Heuer的博客帖子 a>如果您仍遇到问题,请解决文件位置错误
If you don't need to be Flash-compatible with the security policy, try using the Silverlight-specific clientaccesspolicy.xml and see if you get the same error. Check out Tim Heuer's blog post about troubleshooting file location errors if you still are having issues
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="*" />
</allow-from>
<grant-to>
<resource include-subpaths="true" path="/" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
这篇关于CrossDomain错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!