1、错误提示:调用时提示如下错误信息
这可能是由于试图以跨域方式访问服务而又没有正确的跨域策略,或策略不适用于 SOAP 服务。您可能需要与该服务的所有者联系,以发布跨域策略文件并确保该文件允许发送 SOAP 相关的 HTTP 标头。出现此错误也可能是由于使用的是 Web 服务代理中的内部类型而没有使用 InternalsVisibleToAttribute 属性。有关详细信息,请参阅内部异常。
js的ajax跨域请求、2、解决方法:
a、到iis网站的根目录“C:\inetpub\wwwroot”下创建”ClientAccessPolicy.xml”文件,此文件的内容如下
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
iframe跨域调用js。clientaccesspolicy.xml is for silverlight
b、到iis网站的根目录“C:\inetpub\wwwroot”下创建”crossdomain.xml”文件,此文件的内容如下
<?xml version="1.0"?>
跨域访问问题?<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
跨域访问控制?<allow-http-request-headers-from domain="*" headers="*" />
</cross-domain-policy>
crossdomain.xml is for flash and also silverlight
ajax调用跨域,3、”ClientAccessPolicy.xml”与”crossdomain.xml”的区别
Silverlight supports two different mechanisms for services to opt-in to cross-domain access:
• Place a clientaccesspolicy.xml file at the root of the domain where the service is hosted to configure the service to allow cross-domain-access.
• Place a valid crossdomain.xml file at the root of the domain where the service is hosted. Silverlight supports a subset of the crossdomain.xml schema. This file format is supported as well by ADOBE FLASH (originally by them).