【问题标题】:Silverlight Cross Domain Problems on AzureAzure 上的 Silverlight 跨域问题
【发布时间】: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


    【解决方案1】:

    我找出问题所在。我打算删除这个问题,但我宁愿把解决方案留在这里,因为其他人可能会遇到同样的问题。

    问题是 MyWCFServices.azuresites.net 在 azure 中被错误地配置为需要 AD 身份验证。一旦我删除了该要求,它就可以正常工作。我仍然不知道为什么会出现不相关的错误消息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-03
      • 2011-07-25
      • 2010-11-24
      • 2023-03-07
      • 2013-09-30
      • 1970-01-01
      • 2011-09-22
      • 2011-01-13
      相关资源
      最近更新 更多