使用 WCF 的 Silverlight 中的跨域策略错误 [英] cross-domain policy error in Silverlight with WCF

查看:26
本文介绍了使用 WCF 的 Silverlight 中的跨域策略错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将 Silverlight 应用程序连接到 WCF 服务时出现以下错误.我将此 wcf 作为自托管服务托管.

I'm getting the following error when I connect my Silverlight app to my WCF service. I host this wcf as a self host service.

尝试向 URI 'http://lmr-hero 发出请求时出错/iSponsorWebSite/projectService.svc/basic'.这可能是由于在没有适当的跨域策略的情况下尝试以跨域方式访问服务,或者策略不适合 SOAP 服务.您可能需要联系服务的所有者以发布跨域策略文件并确保它允许发送与 SOAP 相关的 HTTP 标头.此错误也可能是由于在 Web 服务代理中使用内部类型而不使用 InternalsVisibleToAttribute 属性造成的.详情请参阅内部异常.

An error occurred while trying to make a request to URI 'http://lmr-hero/iSponsorWebSite/projectService.svc/basic'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.

此错误的可能原因是什么?

What are the possible reasons for this error?

推荐答案

如果您的 Silverlight 应用程序与服务不在同一个域中,那么您需要将 clientaccesspolicy.xml 或 crossdomain.xml 文件放在服务器上托管服务.

If your Silverlight application is not hosted on the same domain as the service then you will need to put a clientaccesspolicy.xml or crossdomain.xml file on the server that hosts the service.

有关详细信息,请参阅此链接:http://msdn.microsoft.com/en-us/library/cc197955%28VS.95%29.aspx

See this link for details: http://msdn.microsoft.com/en-us/library/cc197955%28VS.95%29.aspx

这篇关于使用 WCF 的 Silverlight 中的跨域策略错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆