【发布时间】:2011-05-12 08:58:37
【问题描述】:
我在两种情况下使用 silverlight 4 应用程序。
场景 1:Silverlight 和 RPC 在同一台机器上
-
silverlight XAP 在文件系统上的网页上运行,同时也在文件系统上:
C:\Silverlight\FSSilverlightApp\bin\Debug\SilverlightApplication2TestPage.html -
连接到本地主机上的网站,正在访问:
https://localhost/rpc/someMethod -
这是两个独立的 URI,因此浏览器检测并立即请求(通过 fiddler 跟踪):
https://lcoalhost/clientaccesspolicy.xml成功返回:
<?xml version="1.0" encoding="utf-8"?> <access-policy> <cross-domain-access> <policy> <allow-from http-request-headers="*"> <domain uri="http://*"/> <domain uri="https://*" /> </allow-from> <grant-to> <resource path="/" include-subpaths="true"/> </grant-to> </policy> </cross-domain-access> </access-policy> -
然后应用程序能够发出 rpc 请求(通过 fiddler 观察)
一切都很好。如果我将远程主机更改为本地机器名称而不是 localhost,那也可以正常工作。
场景 2:Silverlight 在本地机器上并且 RPC 是远程的
- 在这个场景中,我使用不同的桌面来访问场景 1 中使用的同一个 RPC 服务器。
- Silverlight 已启动,但未发出对 clientaccesspolicy.xml 的请求
- Fiddler 显示大量 https 隧道正在建立,但我的机器和远程服务器之间没有通信。
返回以下安全异常:
System.Security.SecurityException ---> System.Security.SecurityException: Security error.
at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResultasyncResult)
at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(ObjectsendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
--- End of inner exception stack trace ---
at Microsoft.FSharp.Control.WebExtensions.AsyncGetResponse@1781-1.Invoke(Exception _arg1023)
at Microsoft.FSharp.Control.AsyncBuilderImpl.callA@736.Invoke(AsyncParams`1 args)
我认为这是一个 IE 配置问题。我尝试在方案 1 中将机器设置为 Internet Explorer 中的受信任站点,但这似乎不起作用……这一定是自签名或不匹配的证书问题。有什么想法吗?
使用:IE 8 和 Windows 7
想法?
【问题讨论】:
标签: silverlight security silverlight-4.0 internet-explorer-8 cross-domain