I have a silverlight 4 app. When I made that it created 2 projects. My actual silverlight app and one called MySolutionName.web (not sure what that does except host my silverlight page).
Based on feed back from this question I added my WCF stuff to the MySolution.web project. But when I call the service from my silverlight app the value for my return object is empty (just has a property called PropertyChanged that i开发者_如何学Gos null).
I want to try calling the WCF service using WCF Test Client, but I don't know the URL for it. How can I figure that out?
Just take a look on the ServiceReferences.ClientConfig file within the Silverlight app project.
This file is created when you add service reference. The endpoint element has an attribute address. I believe that's what you are looking for. Because you are hosting your WCF in a different project than the one that host the Silverlight app you should make sure you have the clientaccesspolicy.xml file in the solution/project that hosts the wcf services. Below is an example of the content of the file:<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="http://*"/>
<domain uri="https://*" />
</allow-from>
<grant-to>
<resource include-subpaths="true" path="/"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
This file is used for crossdomain calls. By default Silverlight can only talk to the domain that originated the xap file.
精彩评论