Skip to content
MtrXTools

The remote certificate is invalid according to the validation procedure

.NET doesn't trust the server's certificate

Seen in .NET (AuthenticationException), HttpClient, SslStream, SqlClient, MailKit

The server certificate failed .NET validation; newer versions append the reason, such as UntrustedRoot or RemoteCertificateNameMismatch.

Common causes

  • RemoteCertificateChainErrors or UntrustedRoot: a private or corporate CA, or a missing intermediate.
  • RemoteCertificateNameMismatch: the certificate does not cover the hostname used.
  • The certificate has expired.
  • A Linux container without an up-to-date CA store.

How to fix it

  1. Read the reason after the message and fix that: chain, name or expiry.
  2. Install the private CA in the OS trust store (update-ca-certificates on Linux, Trusted Root store on Windows).
  3. Serve the full chain from the server.
Check the certificate chain

Got a different message? Paste it into the error explainer.

Related errors

All 32 Languages & runtimes errors