Calling https wcf service from silverlight
I am trying to access the https wcf service from silverlight. clientaccesspolicy is put in the root of the service and I have verified with silverlightspy it showing it as valid and calls allowed. I can call this web service successfully from a desktop client, but when I try to call from silverlight, it throws an error causing .... the service failure could be poliecy cross domain, etc. invalid .... have any ideas ???? here also the internetworking service policy applies:
<?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 include-subpaths="true" path="/" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
a source to share
This is a great source of information on silverlight + wcf:
http://www.netfxharmonics.com/2008/11/Understanding-WCF-Services-in-Silverlight-2
a source to share
If the silverlight service and application are served from the same website and you are using Silverlight 4, you can accomplish this without the cross-domain policy file:
- Accessing the silverlight app via https
- Using a relative address in the ServiceReferences.ClientConfig file to access the service
- Using transport mode security in BasicHttpBinding for a service.
Here's an example of ServiceReferences.ClientConfig:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMyService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<!--Transport mode security (setup the same way on the server):-->
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<!--Relative address (This is the part that requires SL4):-->
<endpoint address="../Services/MyService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService"
contract="MyApplication.MyService" name="BasicHttpBinding_IMyService" />
</client>
</system.serviceModel>
</configuration>
a source to share