SilverLight4调用WebService跨域访问问题

 2023-09-15 阅读 22 评论 0

摘要:1、错误提示:调用时提示如下错误信息 这可能是由于试图以跨域方式访问服务而又没有正确的跨域策略,或策略不适用于 SOAP 服务。您可能需要与该服务的所有者联系,以发布跨域策略文件并确保该文件允许发送 SOAP 相关的 HTTP 标头。出现此错误也可能是由于使

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).

转载于:https://www.cnblogs.com/zhzl/archive/2011/03/07/1973380.html

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/2/56789.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息