Workaround for the ArcGIS API for Silverlight call WebService cross-domain access error

Source: Internet
Author: User
Tags silverlight

Source: ArcGIS API for Silverlight call WebService a workaround for cross-domain access errors

Several friends in the group mentioned the problem, saying that they called the WebService method in Silverlight, and reported the error in the following map:


Workaround:

1. Make sure that your Silverlight project and the Web program hosting Silverlight contain 2 cross-domain files, namely crossdomain.xml and ClientAccessPolicy.xml, in the root directory:

crossdomain.xml file, as follows:

<?xml version= "1.0"?>    <cross-domain-policy>    <allow-access-from domain= "*"/></ Cross-domain-policy>
ClientAccessPolicy.xmlFile, as follows:

<?xml version= "1.0" encoding= "Utf-8"?><access-policy>  <cross-domain-access>    <policy >      <allow-from>        <domain uri= "*"/>      </allow-from>      <grant-to>        < Resource Path= "/" include-subpaths= "true"/>      </grant-to>    </policy>  </ Cross-domain-access></access-policy>


2. When adding a Web service reference in Silverlight, do not use a similar http://localhost:90801/XXX/with VS Xxx.asmx address, deploy a Silverlight-hosted Web program to IIS, and then add a Web service reference, with an address similar to Http://localhost/XXX/YYY/xxx.asmx, if your webservice is correct. The next step is important, open the reference after the completion of the service reference configuration file, if the service address is local, please remove the address of the application name in front of the symbol, such as:




After the processing of the above steps, the debug run program will not appear cross-domain error prompts, write out, so that later people encounter this problem can be less detours.


Workaround for the ArcGIS API for Silverlight call WebService cross-domain access error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.