I have a WCF service using both BasicHttpBinding and NetTcpBinding on different endpoints within the same ServiceHost. NetTcp uses a self-signed certificate that is loaded from the file, everyone was fine until I try to use BasicHttpBinding, so I:
On server:
var ServiceHost host = new ServiceHost(blah blah); host.Credentials.ServiceCertificate.Certificate = GetCertificate();
On the client:
ChannelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None; var cer = GetCertificate(); ChannelFactory.Credentials.ClientCertificate.Certificate = cer; var httpBinding = new BasicHttpBinding(); httpBinding.Security.Mode = BasicHttpSecurityMode.Transport; httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; //accept any cert System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
However, when I connected, I got this error
Exception - An error occurred during an HTTP request https: // localhost / MyService . This may be due to the fact that the server certificate is not configured correctly with HTTP.SYS in HTTPS case. It can also be caused by a security binding mismatch between the client and server.
not installed and it works fine with net tcp binding, i think i should skip something small?
One thing I notice is net.tcp is a duplex channel, and basic http is a simplex, I'm sure there is a difference in the setup? For example, I needed to upload a certificate at both ends for net.tcp, what happens with basic HTTP then?
Thank you in advance
source share