clientaccesspolicy.xml 中的通配符allow-from uri 无法让 Silverlight 访问 WCF

发布于 2024-10-07 05:22:22 字数 1045 浏览 0 评论 0原文

我已成功创建并且当前正在使用 clientaccesspolicy.xml 文件将我的 WCF 公开给我的 Silverlight 客户端,其允许域 uri 为 http://*。我想通过使用更具体的 uri(例如 http://www.foobar.comhttp://*.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌酱 2024-10-14 05:22:22

尝试从 URI 中删除“http://”。例如:

<domain uri="*.foobar.com"/>

Try removing "http://" from the URIs. For example:

<domain uri="*.foobar.com"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文