Silverlight clientaccesspolicy.xml 错误?还是设计?
在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您描述的行为与文档一致,其中指出:
http://msdn.microsoft.com/en-us /library/cc645032(VS.95).aspx
因此,端口通配符没有任何意义,当您允许主机和域使用通配符时(您是对的),这没有任何意义。
The behavior you describe is in line with the documentation, which states:
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.
解决方法:
在托管 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.