views:

3698

answers:

3

Hi, I've created a ClientAccessPolicy.xml that looks like this:

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

and put it in C:\Inetpub\wwwroot\wss\VirtualDirectories\intranet-80 and then run an iisreset. Still, when I access the webservices through Silverlight, I get a CommunicationException saying that a correct cross-domain policy isn't in place. What more do I need to do to be able to access my webservices? I cannot access it from another host, and I cannot access it from the generated file E:\Development\MySLProject\ MySLProject\bin\Debug\Default.html?

Cheers

Nik

+2  A: 

You have to put this file in the server root, not in your virtual directory root.

tucod
Hi Tucod, thank's a lot for your answer. I'm a bit confused, this is the root of the web site instance, and the configuration is regarding that instance.Where do I find the server root, and how should I modify my cross-domain-policy to only go with the desired web site, i.e. intranet-80? Cheers -Nik
niklassaers-vc
If your web application is running at http://yourdomain/yourapp/default.aspx the server root is http://yourdomain/ so maybe it is something like c:\inetpub\wwwroot\
tucod
You mentioned your test URL was http://sharepoint/_vti_bin/Lists.asmxso you should also be able to load http://sharepoint/ClientAccessPolicy.xml- if both those links work from your web browser they should work in Silverlight.
CraigD
+1  A: 

In the past I had a similar problem with the clientaccesspolicy.xml file and nothing I did to the file would get my Silverlight app to accept it and proceed onto calling the web services. I was using ProxyTrace to make sure the file was being requested by Silverlight and returned correctly which it was.

Eventually out of desperation I removed the clientaccesspolicy.xml file and tried the alternative crossdomain.xml file which is meant to be for Silverlight to work with Flash targetted web sites and that worked straight away.

sipwiz
A: 

Thanks for the answers, guys. The reason could be one out of two: ClientAccessPolicy.xml should according to MS documentation be clientaccesspolicy.xml (all lower case). But I still get the error, and it's placed in the document root. When doing the call from an URL starting with file:// there is never made a request for the policy document. When calling from a http://localhost URL the reason seems to be that I get a 401 Authorization Required. So in my webservice call I need to add some transient authentication. Now to figure out how that is done... :-)

Update: I was mistaken about the 401, that was a 401 that became authenticated and returned a 200 or 304, so the cross-domain policy IS transfered. Yay.... but.... I still get the following error when using the webservice:

"An error occurred while trying to make a request to URI 'http://sharepoint/_vti_bin/Lists.asmx'. 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."

So, I know the cross domain policy is being retrieved. Is there something wrong with it? I've checked with a Microsoft-provided policy, and it looks identical to me. Even did a copy-paste, still identical. Is this policy not well suited for SOAP webservices? Again, when using it from the same domain, my call works beautifully, but I'd like to make calls to multiple domains, so I need to get this cross-domain policy working

Cheers

Nik

niklassaers-vc