Silverlight clientaccesspolicy.xml 错误?还是设计?

发布于 2024-08-23 14:51:15 字数 532 浏览 4 评论 0原文

在 clientaccesspolicy 文件的域节点中,您可以为子域或协议指定通配符,但它不会显示为端口。

具体来说,在开发时,如果使用的服务托管在第三方上,则从本地主机 asp.net 开发服务器上运行的 silverlight 应用程序的本地调试版本进行访问可以在节点上正常工作:(

<domain uri="*"/>
<domain uri="http://*"/>
<domain uri="http://localhost:1234"/> 

其中 1234 是特定确定的端口号)

但如果​​在表单中指定,它似乎不起作用,

<domain uri="http://localhost:*"/>

如果有多个开发人员/项目使用该服务,或者您没有为 asp.net 开发服务器指定端口,那么这是非常烦人的

有谁知道我是否只是简单地获取格式不正确,或者这是 silverlight 处理客户端访问策略时的错误或疏忽?

In the domain node of a clientaccesspolicy file you can specify a wildcard for a sub domain or protocol, but it would appear not for a port.

Specifically when developing, if the service consumed is hosted on a third party, then access from a local debug version of a silverlight app running on the localhost asp.net development server works fine with the nodes:

<domain uri="*"/>
<domain uri="http://*"/>
<domain uri="http://localhost:1234"/> 

(where 1234 is the specific determined port number)

but it would appear not to work if specified in the form

<domain uri="http://localhost:*"/>

which is extremely annoying if there are multiple developers/projects using the service or you do not specify a port for the asp.net development server

Does annyone know if I am simply getting the format incorrect or is this either a bug or an oversight in the handling of the clientaccesspolicy by silverlight?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

ぺ禁宫浮华殁 2024-08-30 14:51:15

您描述的行为与文档一致,其中指出:

通配符分为三种类型
允许:

独立的“*”通配符。这个选项
用于允许访问所有域
属于同一方案。 HTTP 服务
将允许所有 HTTP 调用者。 HTTPS
服务将允许所有 HTTPS 调用者。

“http://*”文字通配符。这
选项明确允许所有 HTTP
调用者,即使这是 HTTPS
服务。

子域通配符。该选项使用
第一段的通配符
路径(“http://.contoso.com”,用于
示例)允许所有子域
指定的域。所以对于
例子。 http://web.contoso.com
http://mail.contoso.com 将是
允许。请注意 uri 路径
通配符不会作为
前缀(例如 http://web.
.com)
是不允许的。

http://msdn.microsoft.com/en-us /library/cc645032(VS.95).aspx

因此,端口通配符没有任何意义,当您允许主机和域使用通配符时(您是对的),这没有任何意义。

The behavior you describe is in line with the documentation, which states:

There are three types of wildcards
allowed:

A standalone '*' wildcard. This option
is used to allow access to all domains
of the same scheme. An HTTP service
will allow all HTTP callers. An HTTPS
service will allow all HTTPS callers.

An "http://*" literal wildcard. This
option explicitly allows all HTTP
callers, even if this is an HTTPS
service.

A subdomain wildcard. This option uses
a wildcard at the first segment of the
path ("http://.contoso.com", for
example) that allows all subdomains of
the domain specified. So for the
example. http://web.contoso.com and
http://mail.contoso.com would be
allowed. Note that a uri path where
the wildcard does not occur as a
prefix (http://web.
.com, for example)
is disallowed.

http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx

So there's nothing about wildcards for ports, which (you're right) does not make any sense when you allow wildcards for hosts and domains.

夜唯美灬不弃 2024-08-30 14:51:15

解决方法:

在托管 SL 应用程序的网站的属性下,转到网络选项卡,然后将自动分配端口更改为特定端口 >。这样,您可以在 clientaccesspolicy 文件中设置 localhost:1234 端口,正如您已经说明的那样,并且无论哪个开发人员随后使用该项目,都不需要更改端口。

这不是一个完美的解决方案,因为自动分配总是比项目中硬设置端口更好。但这是一个值得尝试的好选择。

Work-around:

Under Properties of your website hosting the SL app, go to the Web tab, and change the Auto-assign Port to Specific Port. This way, you can set your localhost:1234 port in the clientaccesspolicy file as you already illustrated, and expect it not to need a port change no matter what developers also then use the project.

This is not a perfect solution, as its always nicer to auto assign rather than hard set ports in projects. Buts its a good option to try.

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