silverlight地图出错问题A security exception occured while trying to connect to the REST endpoint.Make sure you have a cross...

今天,做的差不多的程序,一直在本机跑着,突然,叫同事访问看web,问题来了:

 

第一反应就是按以下方式检查

A:C:\inetpub\wwwroot 下已经放了clientaccesspolicy.xml与crossdomain.xml的两个文件;

B:并且IIS中已经配置了添加MIME映射:
     (1).xaml   application/xaml+xml  (2).xap    application/x-silverlight-app
当然,win7系统下已经有了这个设置。
但是还是提示图示或以下文字错误:
地图服务器出错:A security exception occured while trying to connect to the REST endpoint.Make sure you have a cross domain

policy file available at the root for your server that allows for requests from this application.

怎么办?

四处搜索,http://msdn.microsoft.com/zh-cn/library/cc645032(v=vs.95).aspx看这个配置等等,都解决不了;后来才发现以下内容。
解决办法:(如map:http://computername/ArcGIS/rest/services/namemap/MapServermachine,web:http://IP/webname)让computername与IP都一样即可。
1、检查地图服务发布和链接是否与访问web页面的方式一样,如一个是机器名,另一个是IP的方式原因。
2、让程序配置中的地图发布地址与web程序访问中的网段一样即可(要么都用机器名,要么都有IP)。

解决,大功告成。不过,我难以理解:silverlight对配置的地图服务与web访问(computername与IP)不一样,为什么不能认,反而认为是跨域了?

望高人指点,谢谢!

posted on 2012-03-28 16:17  云中深海  阅读(2135)  评论(3编辑  收藏  举报