【问题标题】:BingMaps Silverlight can not use tilesouce that is http, only https worksBingMaps Silverlight 不能使用 http 的tilesouce,只有 https 有效
【发布时间】:2013-03-30 09:11:12
【问题描述】:

我一直在关注一大堆关于如何在 bing 地图 silverlight 中使用叠加层的教程,但它们似乎都没有提到我的这个问题。

教程示例:https://alastaira.wordpress.com/2011/01/07/accessing-a-wms-tile-server-from-bing-maps-silverlight/

发生的情况是我将 tilesource 设置为:“http://wms1.ccgis.de/cgi-bin/mapserv?map=/data/umn/germany/germany.map&&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&SRS=EPSG%3A4326&BBOX={0}&WIDTH=256&HEIGHT=256&LAYERS=Bundeslaender”

当我运行应用程序并使用提琴手检查调用时,不会对该服务进行一次调用。如果我将源更改为以 https 开头,则可以在 fiddler 中看到调用。

我还尝试启动一个网络客户端并在http://google.com 上执行获取请求,而提琴手实际上记录了对http://google.com/clientaccesspolicy.xml 的调用,这似乎与它的工作方式一致。

我的网站根目录中有以下 xml 文件。

ClientAccessPolicy.xml

    <?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="SOAPAction">
        <!-- IMPORTANT! Include these lines -->
        <domain uri="https://*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

crossdomain.xml

<cross-domain-policy>
    <allow-access-from domain="*.*" headers="SOAPAction"/>
    <allow-http-request-headers-from domain="*.*" headers="SOAPAction"/> 
    <site-control permitted-cross-domain-policies="master-only"/>
</cross-domain-policy>

有人有什么想法吗?似乎 bingmaps SDK 甚至拒绝尝试 http 调用。

【问题讨论】:

    标签: silverlight http bing-maps crossdomain.xml clientaccesspolicy.xml


    【解决方案1】:

    如果您自己的 Silverlight 应用程序托管在 https 上,则它无法向任何 http 站点发出请求。我认为这就是原因 - 否则它应该可以工作

    【讨论】:

    • 是的,它是通过 https 托管的,但如果这是真的,那么为什么 Web 客户端对象可以通过 http 发出请求?常规的 Bingmap 引擎也通过 http 请求。
    • ???如果 .xap 托管在 https 上,则不能。它只能在 https 上请求。如果您监控 Bing 地图生成的流量,如果 .xap 托管在 https 上,它应该切换到 https 以获取数据
    • 嗯,你是对的,在进行了更多测试后,我确定我的成功是由于我在我的计算机上启用了受信任模式并在 silverlight 5 项目属性中为其设置了设置。我没有意识到这允许交叉调用,但前提是你使用 localhost 调用它。
    猜你喜欢
    • 2016-08-10
    • 2017-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-04
    • 1970-01-01
    • 2014-01-28
    • 1970-01-01
    相关资源
    最近更新 更多