gpt4 book ai didi

c# - 无法从 Azure 网站访问 SQL Azure DB,但相同的连接字符串可以从本地网站访问

转载 作者:行者123 更新时间:2023-11-30 19:15:47 25 4
gpt4 key购买 nike

即使相同的连接字符串可以从本地网站工作,我也无法从 Azure 网站访问 SQL Azure DB。错误如下:

System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'XYZ'.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,
Boolean breakConnection, Action`1 wrapCloseInAction) at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,
Boolean callerHasConnectionLock, Boolean asyncClose) <...>
Error Number:18456,State:1,Class:14 <...>

检查之前的答案后,

  1. 我已将数据库添加到 Azure 门户上网站的链接资源中。 enter image description here
  2. 我已将 0.0.0.0 - 255.255.255.255 范围添加到我的防火墙排除列表 不需要! enter image description here
  3. 我已确保我的连接字符串使用不允许任何 ambiguity
  4. 我已确保 ApplicationDbContext 是使用 correct connection string 构建的。

我还能尝试什么?

网站代码是 here

最佳答案

我不确定您正在使用哪个门户,但是...在预览门户 (portal.azure.com) 中,您的数据库设置页面将有一个指向服务器的链接,您将在那里找到防火墙设置。除了 IP 范围之外,还有一个选项允许 Azure 服务访问您的数据库。您需要启用该功能。

manage.windowsazure.com 中的情况相同 - 可通过“配置”选项卡访问设置。

关于c# - 无法从 Azure 网站访问 SQL Azure DB,但相同的连接字符串可以从本地网站访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33353863/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com