Silverlight and SSL WCF Web service
How to get your Silveright application to workwith a WCF web service using SSL / https? You'll need to change a few things. I'll explain them here.
Server
First, make sure your service is accessible under https. You can do that by adding a binding configuration.
<bindings>
<basicHttpBinding>
<binding name="HttpsBinding">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
Add this binding configuration in the "system.serviceModel" section.
Now tell your web service endpoint to make use of this binding:
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="HttpsBinding" etc...
Client (Silverlight)
That was the server side of the web service, you will also need to change the client side (Silveright). In Silverlight, there a ServiceReferences.ClientConfig file, it defines the binding of the WCF web service.
Change this line:
<security mode="None" />
in: <security mode="Transport" />
Also make sure the endpoint points to the correct https:// address in this configuration file.
Finally, check the way you are instantiating your proxy in Silverlight code.
It must be like this:
WcfServiceClient proxy = new WcfServiceClient();
You can not make your proxy like this for SSL web services:
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("https://etc");
WcfServiceClient proxy = new WcfServiceClient(binding, address);
If you're making the proxy like the last example, you're overriding the values in your ServiceReferences.ClientConfig file. The binding also has to know it must use Transport mode security.
Example:
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);