c# - Consume WCF Service from silverlight 4 -


i have solution contain silverlight 4 project , wcf class library project. , add service refrence wcf service in silverlight project (wcf not published on iis). try call service silverlight project, gives me following exception:

an error occurred while trying make request uri http://localhost:8732/design_time_addresses/customwcfservice/myservice/. due attempting access service in cross-domain way without proper cross-domain policy in place, or policy unsuitable soap services. may need contact owner of service publish cross-domain policy file , ensure allows soap-related http headers sent. error may caused using internal types in web service proxy without using internalsvisibletoattribute attribute. please see inner exception more details.

i try solve problem adding following 2 files wcf library project

1) clientaccesspolicy.xml has following xml

<?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> 

2) crossdomain.xml contains following xml

<?xml version="1.0"?> <!doctype cross-domain-policy system "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> <cross-domain-policy> <allow-http-request-headers-from domain="*" headers="*"/> </cross-domain-policy> 

then build wcf project , update service refrence in silverlight project same exception still exist.

what should handle exception? should publish service? , considered self hosting ??

put clientaccesspolicy.xml file root of iis. in example c:\inetpub\wwwroot


Comments