Using Encrypt=yes in a Sql Server connection string -> “provider: SSL Provider, error: 0 - The certificate's CN name does not match the passed value.”

后端 未结 2 1267
北海茫月
北海茫月 2020-12-08 16:24

I\'m using Encrypt=yes in a SQL Server connection string, as I need the TCPIP traffic to be encrypted, but on opening the connection I get an error:

<         


        
相关标签:
2条回答
  • 2020-12-08 16:35

    I realize this is pretty old, but thought this might still help someone.

    If the server you are connecting to does not have a certificate installed, a default certificate number is generated each time the server is restarted. When this happens the CN number changes, and might not match the one you have.

    I read this recently, but I'm still trying to find the link for you. I'd suggest you makes sure that the server you are connecting to has explicitly installed a certificate, and that your client has it too.

    I'll update this as soon as I find the link.

    0 讨论(0)
  • 2020-12-08 16:50

    Your database connection can be configured to encrypt traffic and to accept any certificate from your server. Not a grand solution, but it worked for me.

    The resulting connection string should look like this:

    "[...];Encrypt=True;TrustServerCertificate=True"
    
    0 讨论(0)
提交回复
热议问题