System.ArgumentException 不支持关键字 trustserver certificste怎么解决
调试错误出现在 Conn=sqlconnection(connstr)
System.ArgumentException 不支持关键字 trustserver certificste怎么解决
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
张小兔爱钱钱 2023-06-15 09:04关注这个错误通常是由于连接字符串中存在语法错误导致的。在连接字符串中,不应该使用 "TrustServerCertificate" 和 "Certificate" 这两个关键字。
如果确实需要在连接 SQL Server 数据库时使用证书认证,可以使用以下连接字符串格式:
Server=myServerAddress;Database=myDataBase;User Id=myUsername; Password=myPassword;Encrypt=True;TrustServerCertificate=False; Certificate=<path-to-certificate>;其中,Encrypt 参数指定使用 SSL 加密数据传输,TrustServerCertificate 参数指示是否信任服务器证书,Certificate 参数指定客户端证书的路径。
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决评论 打赏 举报无用 1