appsettings.json 中的 ConnectionStrings 与 ssl?网络核心

ConnectionStrings in appsettings.json with ssl? Net Core

如何将 api 连接到 Azure mysql 数据库。

也许需要改变这个

"MySqlDbConnectionX": "Server = mydb.mysql.database.azure.com; Database = db; User Id = id; Password = password;"

为此

"MySqlDbConnectionX": Server = "mydb.mysql.database.azure.com"; UserID = "id"; Password = "{your_password}"; Database = "{your_database}"; SslMode = MySqlSslMode.Required; SslCa = "{path_to_CA_cert}"

我需要知道证书的路径,但我不知道放在哪里。

如果有人有例子,请发给我。

从您的描述中,我们可以清楚地知道您正在使用 Azure DataBase Mysql。

By default, Azure Database for MySQL enforces SSL connections between your server and your client applications to protect against MITM (man in the middle) attacks. This is done to make the connection to your server as secure as possible.

,我们可以清楚地知道我们不需要在我们的连接字符串中添加 SslMode = MySqlSslMode.Required; SslCa = "{path_to_CA_cert}"

而且我还阅读了一些关于 的描述。

使用托管的 Azure MySQL 实例时,无法在 MySQL 服务器上存储 CA 证书。


所以如果你想启用ssl,你可以直接从Azure门户复制并使用连接字符串。