clientaccesspolicy.xml 中的通配符allow-from uri 无法让 Silverlight 访问 WCF
我已成功创建并且当前正在使用 clientaccesspolicy.xml 文件将我的 WCF 公开给我的 Silverlight 客户端,其允许域 uri 为 http://*
。我想通过使用更具体的 uri(例如 http://www.foobar.com
或 http://*.foobar.com
)来加强它,但是当我使用这些 uri 时,我在 Silverlight 客户端中收到 SecurityExceptions。
作为参考,以下是当前正在运行的 clientaccesspolicy.xml:
<访问策略>
<跨域访问>
<政策>
<域名 uri="http://*"/>
<授予给>
<资源路径=“/”include-subpaths=“true”/>
我尝试将 http-request-headers 更改为“*”但无济于事。我已经验证,在保护 .txts 或 .pngs 等非 WCF 资源时,通配符 uri(和资源路径)对我有用。我的 clientaccesspolicy.xml 与 .svc 位于同一目录中。
我无法使用 crossdomain.xml,因为它不允许特定的 uri(请参阅 http://msdn.microsoft.com/en-us/library/cc838250(VS.95).aspx)。
谢谢!
I've successfully created and am currently using a clientaccesspolicy.xml file to expose my WCF to my Silverlight client, with an allow-from domain uri of http://*
. I'd like to tighten it up by using a more specific uri like http://www.foobar.com
or http://*.foobar.com
, but when I use those uris, I get SecurityExceptions in my Silverlight client.
For reference, here is the currently working clientaccesspolicy.xml:<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="http://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
I've tried changing http-request-headers to "*" to no avail. And I've verified that wildcard uris (and resource paths) work for me when securing non-WCF resources like .txts or .pngs. My clientaccesspolicy.xml is living in the same directory as the .svc.
I can't use a crossdomain.xml, as that doesn't allow specific uris (see http://msdn.microsoft.com/en-us/library/cc838250(VS.95).aspx).
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试从 URI 中删除“http://”。例如:
Try removing "http://" from the URIs. For example: