Skip to content

Instantly share code, notes, and snippets.

@brandedoutcast
Created October 25, 2018 11:56
Show Gist options
  • Save brandedoutcast/1c99eaeaeec156cc5db9cb9955e7fd93 to your computer and use it in GitHub Desktop.
Save brandedoutcast/1c99eaeaeec156cc5db9cb9955e7fd93 to your computer and use it in GitHub Desktop.
Ignore SSL certificate check in a WCF service for .NET Framework & dotnet core
// For dotnet core
// Put this inside the Proxy client constructor
this.ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new System.ServiceModel.Security.X509ServiceCertificateAuthentication()
{
CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None,
RevocationMode = System.Security.Cryptography.X509Certificates.X509RevocationMode.NoCheck
};
// For .NET Framework
// Place this anywhere in the program so that it's run before initializing the Proxy client
System.Net.ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, errors) => true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment