Note that there are some explanatory texts on larger screens.

plurals
  1. POSilverlight Enabled WCF Services | Hosted in Website Type Project | .Net 4.0 | Crossdomain Issue
    text
    copied!<p>I need a little help regarding WCF Services. Situation is something like this, I have made a website project in .net 4.0 and then I added a Silverlight-Enabled WCF service with the name AdminService.svc. I wrote a few methods in this service, of course, made them [OperationContracts]. Then I created another Silverlight 5.0 project in the same workspace and tried to consume the service (AdminService.svc), added it's reference in this project (We have to keep in mind that AdminService is running in another website type project in the same workspace). But now everytime I run the application and try to call a method which simply return some data, I get this error !</p> <p>An error occurred while trying to make a request to URI </p> <blockquote> <p>'http://localhost:2850/XYZServices/AdminService.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.</p> </blockquote> <p>Obvious answer to this problem is to add a crossdomain.xml and clientaccesspolicy.xml, right? I have both of them in place in my wcf website type project at the root level with the following content,</p> <p>clientaccesspolicy.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;access-policy&gt; &lt;cross-domain-access&gt; &lt;policy&gt; &lt;allow-from http-request-headers="*"&gt; &lt;domain uri="*"/&gt; &lt;/allow-from&gt; &lt;grant-to&gt; &lt;resource include-subpaths="true" path="/"/&gt; &lt;/grant-to&gt; &lt;/policy&gt; &lt;/cross-domain-access&gt; &lt;/access-policy&gt; </code></pre> <p>and the other one</p> <p>crossdomain.xml</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt; &lt;cross-domain-policy&gt; &lt;allow-http-request-headers-from domain="*" headers="*"/&gt; &lt;/cross-domain-policy&gt; </code></pre> <p>Kindly help me out of this, it's becoming troublesome now.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload