I have a WCF service project defined in my Silverlight solution. The solution consists of three projects.
- MySilverLightApplication [the
Silverlight app] - MySilverLightApplication.Web [the web
project that hosts it] - MyWCFService
I want to establish a secure connection between the Silverlight application and the WCF service so I turned on wsHttpBinding on the service side by editing the service project’s web.config file like so:
<services>
<service name="ExternalWcfService.extService"
behaviorConfiguration="ExternalWCF">
<endpoint address="" binding="wsHttpBinding"
contract="ExternalWcfService.IextService"/>
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
When I add a reference to this service in the SL client I get NO entry made in the ServiceReferences.ClientConfig file in the Silverlight app. Why is this so? And then when I run the application I get an error like so:
Could not find default endpoint
element that references contract
‘ExternalWCFService.IextService’ in
the ServiceModel client configuration
section. This might be because no
configuration file was found for your
application, or because no endpoint
element matching this contract could
be found in the client element.
I have the silverlight.config file in the Silverlight root folder. Why is the endpoint not getting created in the SL project?
I think I figured it out. Apparently Silverlight cannot consume a service configured with wsHttpBinding. It needs to be BasicHttpBinding only! I changed the binding to basic and my endpoint was added to the ServiceReferences.ClientConfig file when I updated my reference.
Strange!!! why doesnt Silverlight support encoding over the wire?