codebrothers.net :: Home  >  Matthias Denkmaier
User: Guest  Login
Matthias Denkmaier
C# - what else?
Blog search:  
Calling WCF from Silverlight over SSL failes with error

Just stumbled across a wired error when i tried to access a SSL secured WCF service from Silverlight (3.0).

When I first tried it I got the following error message back:

...An error occurred while trying to make a request to URI ’https://xyz.com/SecureWebServices/AuthService.svc’. 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...

After some research I found the problem to be caused by my clientaccesspolicy.xml which looked like that:

<?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>

The problem is caused by the line:  <domain uri="*"/> within the ’allow-from’ section.
To resolve the problem I simpkle had to change my clientaccesspolicy.xml into:

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


 

Share this post: Email it!
Posted:  4/12/2010 11:03:00 AM  by  mdenkmaier
Tags:  IISHow toSSLWCFSilverlightC#RIA
Comments are not allowed on this item!