3

I need to write some data to the DB from a Silverlight 4 application.

I'm using a Silverlight Enabled WCF Web Service. I've published it to IIS7 and added a ClientAccessPolicy.xml file to the inetpub/wwwroot (among other places) so I can access localhost/ClientAccessPolicy.xml just fine. I also added crossdomain.xml just in case.

I also have a Silverlight4 client app which accesses this service and runs through VS2010 on development server.

When trying to invoke a method in the WebService I'm getting a crossdomain error although I have a crossdomain policy in place and the web service is working fine.

When using Fidler I see I'm getting a 304 error when the client app is trying to access the clientaccesspolicy.xml

If I also publish the client app to IIS7 (both under port 80), I can run it using a browser on the same machine with no problem. But when I try to access it on a different machine, I again get a crossdaomain error.

I tried everything but I can't find an answer for this problem anywhere! Please help!!

This is what my ClientAccessPolicy.xml looks like:

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
    <cross-domain-access>
        <policy>
            <allow-from http-request-headers="SOAPAction">
                <domain uri="http://*"/> 
            </allow-from>
            <grant-to> 
                <resource path="/" include-subpaths="true"/> 
            </grant-to>
        </policy>
    </cross-domain-access>
 </access-policy>
iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202
  • 1
    So how does your clientaccesspolicy.xml look like? – Magnus Johansson May 31 '12 at 13:28
  • Also, what Authentication scheme are you using? – Magnus Johansson May 31 '12 at 13:35
  • 1) crossdomain.xml is never needed if you can use a ClientAccessPolicy.xml file. It is only allowed to support older flash sites that may already have that file. 2) A 304 is not an error, just indicates the file is cached and has not changed. 3) Is inetpub\wwwroot the actual root of your website? 4) *Please* show the contents of your ClientAccessPolicy.xml file. – iCollect.it Ltd May 31 '12 at 13:35
  • Thanks for your reply! This is how my ClientAccessPolocy.xml looks like : – user1426409 May 31 '12 at 13:43
  • You can't post XML data in a comment. Please update your question and paste in the content, select the XML data and click on the {} button in the toolbar to format it as code. But if you actually intend to show us that your file is empty, than that is the problem. Please see how you should compose such a file: http://msdn.microsoft.com/en-us/library/cc197955(v=vs.95).aspx – Magnus Johansson May 31 '12 at 13:48
  • Thanks for your reply! This is how my ClientAccessPolocy.xml looks like : – user1426409 May 31 '12 at 13:58
  • I wasn't using any authentication scheme, but after reading [this](http://ajdotnet.wordpress.com/2010/08/08/silverlight-and-integrated-authentication/) article I switched to – user1426409 May 31 '12 at 13:58
  • The actual root of my website is http://localhost/WCFWebService and i've placed a clientaccesspolicy.xml there also, so this : http://localhost/WCFWebService/clientaccesspolicy.xml also works fine @HiTech Magic – user1426409 May 31 '12 at 14:11

1 Answers1

0

I have struggled with this misleading error "crossdomain error" before and after reading your situation I can tell for sure that ClientAccessPolicy.xml configuration is not the issue here you should look elsewhere.

few things i would do

  1. Check my client config & web service configs(double check endpoints, behaviours and finally binding protocols) on the silverlight app.
  2. Enable error logging for your wcf service.
  3. Make sure you are passing the right authentication token to your web service (enable anonymous authentication for the web application hosting WCF service)).