views:

266

answers:

0

I have some ASP.NET 2.0 web services and I have a Silverlight control that accesses these services. When I run these under the localhost, everything works fine. However, if I deploy the web services to an ASP.NET server and run my simple Silverlight html host locally, Silverlight no longer gets a response from the asynchronous web services - the event just doesn't get raised. I have configured the Silverlight control to have the correct binding to access the services from their hosted location but it just doesn't work.

I have a clientaccesspolicy.xml at the root of the server location as follows:

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

Also, I have tried disabling authentication in the web.config just to see if WIndows authentication was causing a problem but this didn't work.

Does anyone know what could be the problem? Is there possibly a configuration setting on the IIS server to be changed? Do I need to do something special in my Silverlight control to specify credentials?

Any assistance would be great. Thank you!

Update

Okay, I have just solved my issue but I don't really understand the problem. My guess is that the clientaccesspolicy.xml is either malformed or only works for WCF services, whereas my services are ASP.NET 2.0.

I used Web Developer Helper to confirm that the clientaccesspolicy.xml was being retrieved and it was, but it didn't work. So, armed with this MSDN article on cross-domain Silverlight, I tried using a crossdomain.xml instead. This worked (after removing the clientaccesspolicy.xml, of course).

Can anyone explain why the second option worked?