【发布时间】:2015-11-18 07:20:51
【问题描述】:
我的解决方案中有 3 个项目。一个 Silverlight 项目,一个托管 silverlight 并提供一些 WCF 服务的 Web 项目,以及一个带有一些 WCF 服务的第三个 Web 项目,silverlight 客户端将访问这些项目。
在我的客户端机器上工作正常,就像在生产服务器中一样。在我当前的生产服务器中,我将两个服务器 Web 应用程序托管在同一个域中,作为不同的 Web 应用程序。
问题是现在我们正试图将整个事情迁移到天蓝色。我创建了两个网站,每个 WebApp 一个。所以我有,可以说,以下地址: MySLHostWebApp.azuresites.net 和 MyWCFServices.azuresites.net。
silverlight 应用程序正在运行,并且正在正确访问 MySLHostWebApp.azuresites.net 上的服务,当 Silverlight 客户端尝试访问 MyWCFServices.azuresites.net 时购买,我遇到以下错误:
An error occurred while trying to make a request to URI
'http://MyWCFServices.azuresites.net/MyService.svc'. 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.
在网上搜索了这个之后,我发现我必须在我的 WCF 服务中包含一个 clientaccesspolicy.xml 文件,以允许跨域调用,但我的服务已经有了这个文件,内容如下:
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-methods="*">
<domain uri="*" />
</allow-from>
<grant-to>
<resource include-subpaths="true" path="/"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
有谁知道可能是什么问题?
【问题讨论】:
标签: c# asp.net wcf silverlight azure