Cross domain error while accessing wcf service


  • Hi,

    I have a WCF service which is placed on a remote server. The domain of the server is different then the domain of my local system. I have place the clientaccesspolicy.xml and crossdomain.xml files on the root directory of server which hosts the service. when i send a call to the service on server from my silverlight application, i receive following error:-

    An error occurred while trying to make a request to URI ''. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.

    1. crossdomain.xml and clientaccesspolicy.xml files are placed in the website root directory (in wwwroot) on server.

    2. I am able to access service in browser so the service is working on the server.

    3. i am initializing service in code like

    System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding();

    SPConnectorClient service = new SPConnectorClient(binding, new System.ServiceModel.EndpointAddress("http://serverIP/AP.FileManager.Service/SPConnector.svc"));

    4. ServiceReferences.ClientConfig 

                    <binding name="BasicHttpBinding_ISPConnector" maxBufferSize="2147483647"
                        <security mode="None" />
                <endpoint address="http://servername/AP.FileManager.Service/SPConnector.svc"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISPConnector"
                    contract="Ap.FileManager.Service.ISPConnector" name="BasicHttpBinding_ISPConnector" />


    5. Clientaccesspolicy.xml and crossdomain.xml

    <?xml version="1.0" encoding="utf-8" ?>  
           <allow-from http-request-headers="SOAPAction">
             <domain uri="http://*"/>
             <domain uri="https://*" />
             <resource include-subpaths="false" path="/"/>


    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "">
      <allow-http-request-headers-from domain="* " headers="*" />

    Please identify if anything wrong in the policy files or clientconfig file. any idea about any missing thing. Please reply ASAP.

    Thanks in advance.



    Friday, September 03, 2010 8:24 AM