C
C#6d ago
Matronix

How to bypass certificate validation in .NET Core when using a WCF ClientBase object?

We have a new application that needs to talk to a legacy WCF / SOAP service and the target machine will not always have a valid certificate. How to ignore the certificate validation when using a ClientBase. I see many examples for HttpClient but still haven't found a solution for WCF.
2 Replies
Sehra
Sehra6d ago
could try with
client = new MyGeneratedClient();
client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication();
client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication.CertificateValidationMode = X509CertificateValidationMode.None;
client = new MyGeneratedClient();
client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication();
client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication.CertificateValidationMode = X509CertificateValidationMode.None;
Matronix
MatronixOP6d ago
@Sehra perfect! Thank you. I was trying to set this client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None; And that didn't work. I had to just create a new object.

Did you find this page helpful?