Search code examples
c#securityx509certificate2

https using BasicHttpBinding and ignoring certificate errors


I am using BasicHttpBinding to connect a web service hosted on a secured (https) port. To get it working, I have changed the Security.Mode to TransportWithMessageCredential and Security.Message to BasicHttpMessageCredentialType.Cerificate. I am also calling

client.ClientCredentials.ClientCertificate.SetCertificate()

with localhost as the subject name.

The issue here is that for unit testing, I have an unsigned certificate from the web server and am supposed to ignore any certificate error thrown during the proxy creation; but I am unable to do so, because I keep getting an error telling me to "specify a certificate". Right now, I am clueless; I appreciate any help here.


Solution

  • For server ssl, the SecurityMode should be set to Transport.