c# - 天蓝色会员 System.Data.SqlClient.SqlException:Azure 中用户“{your_username}”的登录失败
问题描述
我正在尝试部署旧的会员数据库和 asp.net,当将应用程序部署到 Azure 时,问题就出现了。我使用 localhost 连接到 Azure 中的数据库,当我可以在本地运行应用程序同时仍连接到 Azure 数据库(将我的 IP 列入白名单)时,我可以正常登录。
当我使用我在本地所做的所有相同设置将我的网站发布到 Azure 时,问题就出现了。我仍然指向之前的 Azure 数据库,但在尝试运行 Membership.ValidateUser System.Data.SqlClient.SqlException: Login failed for user '{your_username}' in Azure 时出现 SQL 错误。
我花了很多时间试图弄清楚发生了什么。任何帮助将不胜感激。
解决方案
我找到了问题的答案。连接字符串需要这个 Encrypt=True; MultipleActiveResultSets=假;TrustServerCertificate=False;连接超时=30;