Silverlight 应用程序发出 GET 请求时出现系统安全异常
我是银光新手。我一直在尝试修补一个 silverlight 应用程序,该应用程序通过网络向某些网站(例如谷歌)发出获取请求。但是,我一次又一次地收到 system.security 异常。我阅读了各种其他帖子,我收集到的是,为了使这些事情发挥作用,您需要在创建项目时选择“新网站中的主机应用程序”选项,我已经这样做了,但仍然遇到相同的异常。我从 http:// 下载了该应用程序www.shinedraw.com/data-handling/flash-vs-silverlight-simple-http-post-request/并在VS2010中点击debug运行它,仍然它给出了同样的例外。 请告诉我我做错了什么,我知道它的跨域问题,但不知道还能做什么。 这篇文章的第二个答案 - WebClient.DownloadStringAsync 在 Silverlight 中引发安全异常,我认为,提供了一种解决方法,但这是否意味着无法直接从 silverlight 访问此类服务? -
请有经验的用户解释一下。
I am new to silverlight. I have been trying to patch up a silverlight app that makes a get request to some site over the net, say google. However, I keep getting the system.security exception again nd again. I read various other posts and what i gathered is that for these things to work u need to choose HOST APPLICATION IN A NEW WEBSITE option while creation of the project, i have done that, but still get the same exception. I downloaded the app from http://www.shinedraw.com/data-handling/flash-vs-silverlight-simple-http-post-request/ and ran it by clicking debug in VS2010, still it gave the same exception.
Please tell me what i am doing wrong, i know its cross domain issues, but dont know what else to do.
The second answer at this post - WebClient.DownloadStringAsync throwing Security Exception in Silverlight, I think, offers a workaround, but does this means there is no way to access such services from silverlight directly?? -
Experienced users please explain.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法直接从 Silverlight 应用程序调用您自己的域以外的 Web 服务。如果您想这样做,则必须在托管该服务的服务器上安装跨域策略。但您始终可以在自己的 Web 应用程序(托管 Sivlerlight 应用程序)中安装 Web 服务,并从该服务调用其他服务。这只是一个服务电话,但它也适用于您不拥有的服务。
You cannot call a web service other than from your own domain directly from a Silverlight application. If you want to to this, you would have to install a cross-domain policy on the server that hosts the service. But you can always install a web service within your own web application (that hosts the Sivlerlight app) and call the other service from that service. It's one sercie call more but it works also with services you don't own.