Winfx SelfHosted webservice over HTTPS

I'm hosting the service and creating the bindings at runtime.

Currently I get an error when my test client tries to connect "The underlying connection was closed: An unexpected error occurred on a send"

How do I tell ServiceHost which certificate to use for the https

Not sure if below is all I need for configuring the binding to use HTTPS:

string Address = https://10.3.10.10:10870/TestWS/;

ServiceHost MyHost = null;

MyHost = new ServiceHost(typeof(testdomain.net.test), new Uri(Address));

BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);

binding.Security.Transport.ClientCredentialType = System.ServiceModel.Channels.HttpClientCredentialType.Certificate;

MyHost.AddServiceEndpoint(typeof(ITest), binding, Address);

Thanks for any info.




Answer this question

Winfx SelfHosted webservice over HTTPS