CrossDomainError on same domain

前端 未结 2 443
栀梦
栀梦 2021-01-27 23:03

I\'m learning to build Silverlight 3 apps using WCF to communicate with the back end. We are going to deploy to IIS7 on Server2008 or Vista. The client binaries as well as the

相关标签:
2条回答
  • 2021-01-27 23:19

    For two documents to be considered to have the same origin everything must be exactly the same: protocol (http/https), domain and port.

    So, if you open up http://localhost and try to make a request to http://localhost:2721, you'll get that error.

    0 讨论(0)
  • 2021-01-27 23:19

    You need to have a crossdomain.xml and/or a clientaccesspolicy.xml at the root of your website (crossdoomain.xml is required for for flash compatability, both work with silverlight). This xml needs to cotain the following:

    <?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>
    
    0 讨论(0)
提交回复
热议问题