title: connect to Postgresql with SSL
body: <p>I am attempting to connect to a postgresql database which uses SSL via my c# application. But I'm unable to work out what the correct connection string would be. Is anyone able to help?</p>
  
  <pre><code>        NpgsqlConnection postgresConn;
          public PostgreManager()
          {
              openConnection();
          }
  
          private void openConnection()
          {
              postgresConn = new NpgsqlConnection("Server=10.153.8.4;Port=5432;Database=au_wa_jpc;User Id=readonly;Password=myPass;");
              postgresConn.Open();
  
          }
  </code></pre>
  
  <p>Edit:</p>
  
  <p>I have attempted to use <code>Ssl Mode=Require;</code> in the connection string, however it throws the following exception.</p>
  
  <p>An unhandled exception of type 'System.IO.IOException' occurred in Npgsql.dll</p>
  
  <p>Additional information: TlsClientStream.ClientAlertException: CertificateUnknown: Server certificate was not accepted. Chain status: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.</p>
  
  <p>. The specified hostname was not present in the certificate.</p>