【发布时间】:2015-11-19 14:08:24
【问题描述】:
我在 Azure 上有一个免费订阅,它附带一个 web 应用程序和一个来自 cleardb.com (Dreamspark) 的小型 mySQL 数据库。 ClearDB 为数据库的 SSL 身份验证提供证书下载,当我尝试使用 MySQL Workbench 或 VisualStudio 直接连接到它时效果很好。
将证书文件复制到 Azure 后,如何在 VisualStudio 中设置连接字符串以指定证书文件的远程路径?
换句话说,我如何指定 Azure 上 ssl 认证文件的路径,以及在哪里使用 SSL 连接到 cleardb?我在“C:\”驱动器上的本地路径显然不起作用。
Web.config 中的 connectionString 应如下所示:
<add name="mySQLExample"
connectionString="server=azure-example.cloudapp.net;
user id=example-user;
password=password;
persistsecurityinfo=True;
connectiontimeout=5;
database=mySQL_db_example;
sslmode=Required;
certificatefile=C:\path\to\cert\file\randomchars-cert.pfx"
providerName="MySql.Data.MySqlClient" />
我猜它是一个 Windows Server,所以我需要一个类似的路径,对吧?或者它是否适用于 UNIX/internet 样式路径,该路径仅使用 ~/randomchars-cert.pfx 指定我在 Azure 上的主目录(这不是很好)吗?
【问题讨论】:
-
服务器日志引用了一个“D:”驱动器,所以看起来免费的 Dreamspark“web 应用程序”站点实际上使用的是 Windows 服务器,并且可能是 ClearDB SSL 密钥的合适路径在 Web.config 中构建。 Azure 门户也有一个 ConnectionString 设置,但我猜这是某种覆盖。
标签: c# mysql asp.net azure ssl