Turn: silverlight4 + web service solution (1)

Source: Internet
Author: User
Tags domain hosting

From: http://www.cnblogs.com/anncesky/articles/1776287.html

 

The first is to solve the problem of accessing Web Service Cross-origin access by SL.

Read the msdn and online materials, which are described in

  • Place a clientaccesspolicy. xml file in the root directory of the domain hosting the service to configure the service to allow cross-origin access.

     

      <?xml version="1.0" encoding="utf-8"?>
    <access-policy>
    <cross-domain-access>
    <policy>
    <allow-from http-request-headers="SOAPAction">
    <domain uri="*"/>
    </allow-from>
    <grant-to>
    <resource path="/" include-subpaths="true"/>
    </grant-to>
    </policy>
    </cross-domain-access>
    </access-policy>

     

     

  • Place a valid crossdomain. xml file in the root directory of the domain hosting the service. This file must mark the entire domain as public. Silverlight supports a subset of the crossdomain. xml architecture.

     

      <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
    <allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"/>
    </cross-domain-policy>

     

     

    However, I believe many friends still use Win XP as the development environment. Naturally, these two files will be placed in the same file as the web service. This will cause a system error.

    The correct method is to place the two files in the directory mapped to the "default website" of IIS.

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