Silverlight至WCF跨域异常,但已成功读取clientaccesspolicy.xml [英] Silverlight-to-WCF cross-domain exception, but clientaccesspolicy.xml is being read successfully

查看:65
本文介绍了Silverlight至WCF跨域异常,但已成功读取clientaccesspolicy.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

clientaccesspolicy.xml :

 <?xml version ="1.0" encoding ="utf-8"?><访问策略><跨域访问>< policy>< allow-from http-request-headers ="*">< domain uri ="*"/></allow-from>< grant-to>< resource path ="/" include-subpaths ="true"/></grant-to></policy></跨域访问></access-policy> 

crossdomain.xml :

 <?xml version ="1.0"?><!DOCTYPE跨域策略><跨域策略>< allow-http-request-headers-from domain ="*" headers ="*" secure ="true"/></跨域策略> 

这里没什么好想的,这是数百万个WCF服务用来允许Silverlight客户端访问它们的标准设置.不幸的是,此设置在我部署到的实时环境中不起作用.用于测试部署的预生产环境的安装方式与实际运行相同(因此,系统管理员如此称呼),并且一切在此都可以正常运行,这就是为什么我如此困惑的原因.

我有一位系统管理员使用HTTPDebuggerPro跟踪了Silverlight客户端的请求,结果表明该客户端正在检索 clientaccesspolicy.xml crossdomain.xml 而不使用问题(HTTP状态200).但是,在请求这些文件之后,客户端尝试调用该服务,并立即收到 CrossDomainException .

我还尝试让系统管理员将WCF服务URL添加到承载Silverlight客户端的框上的Internet Explorer的允许的站点"列表中(根据解决方案

clientaccesspolicy.xml是否放置在您域的根目录中?

clientaccesspolicy.xml:

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*" />
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true" />
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

crossdomain.xml:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy>
<cross-domain-policy>
  <allow-http-request-headers-from domain="*" headers="*" secure="true" />
</cross-domain-policy>

Nothing fancy here, it's the standard setup millions of WCF services use to allow Silverlight clients to access them. Unfortunately this setup is not working in the live environment I deployed to. The pre-production environment used to test the deploy is setup identically to live (or so the sysadmins claim) and everything works perfectly there, which is why I am so confused.

I had one of the sysadmins trace the request from the Silverlight client using HTTPDebuggerPro, and it shows that the client is retrieving both clientaccesspolicy.xml and crossdomain.xml without issue (HTTP status 200). However, after requesting those files, the client tries to make a call to the service and immediately receives a CrossDomainException.

I have also tried getting the sysadmins to add the WCF service URL to Internet Explorer's "Allowed Sites" list on the box that the Silverlight client is hosted on (as per the last sentence of the last paragraph from http://blogs.msdn.com/b/fiddler/archive/2010/11/22/fiddler-and-silverlight-cross-zone-cross-domain-requests.aspx) but that didn't work either.

HALP!

解决方案

Is clientaccesspolicy.xml placed in the root of your domain?

这篇关于Silverlight至WCF跨域异常,但已成功读取clientaccesspolicy.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆