1
votes

An error occurred while trying to make a request to URI:

'http://localhost:8732/Design_Time_Addresses/WCF/Service1/'. 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.

the error appears when result returned from the wcf

I consumed this wcf via console, website, win forms and it works properly

I use 2 xml files in the WCF library :

  1. clientaccesspolicy.xml
  2. crossdomain.xml
2
Note: You only ever need clientaccesspolicy.xml for Silverlight if the websites are your own. crossdomain.xml is allowed for compatibility with older sites and does not provide as many options.Gone Coding

2 Answers

1
votes

It used to make my brain hurt too.

I figured out for my use I needed this file:

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

named clientaccesspolicy.xml

The trick is that is has to be at the root of your web server. That being said you need to be able to browse the file. In your case located at:

http://localhost:8732/clientaccesspolicy.xml

If you cannot see the file silverlight will always complain and boy does it complain whenever it can!

I should point out that my policy file is not restrictive, so use it wisely.

0
votes

Oh, that problem. Besides the crossdomain, you cannot run the debugger from VS2010 which is what i'm gather from that localhost URL. Try publishing silverlight app on the domain or server that your WCF is on. For example, if your web service is on http://10.xx.xx.xx/sites/myWCF, publish your silverlight app on http://10.xx.xx.xx/sites/MySilverlightApp. You're debugger is going to run as http://localhost:somePort which is definitely going to give you problems even with a cross-domain policy file. Apart from that, ensure that you config file for your web.service is correct. Ensure all the interfaces have endpoint bindings and there is a host on the main service location(sounds obvious, but is a common error).