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.
You need to pass the -k or --insecure option to the curl command. This option explicitly allows curl to perform “insecure” SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default.
You can use the following code to skip certificate validation. This creates a RemoteCertificateValidationCallback
that always return true for any certificate.
System.Net.ServicePointManager.ServerCertificateValidationCallback =
(sender, certificate, chain, errors) => true;
For server ssl, the SecurityMode
should be set to Transport
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With