azure - 新创建的 Azure 应用服务无法连接到现有的 Azure SQL 数据库
问题描述
我创建了一个新的 Azure 应用服务来测试登台。我将现有的应用程序部署到它,但它似乎无法访问现有的数据库。我总是得到这个例外:
Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No such host is known.)
---> System.ComponentModel.Win32Exception (11001): No such host is known.
at Microsoft.Data.ProviderBase.DbConnectionPool.CheckPoolBlockingPeriod(Exception e)
at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()
--- End of stack trace from previous location where exception was thrown ---
但是连接字符串在设置中是正确的并且正确加载。我想可能是,我必须打开数据库上的防火墙才能使用新服务。但在数据库服务器上,该设置已被激活以授予所有服务访问权限。
所有服务都在同一个资源组中。而且我看不出应用服务设置有什么不同。我必须在某处明确启用某些东西吗?
编辑:我复制了现有的应用程序服务并部署到该服务。在这里我可以访问我复制的服务的数据库服务器,但不能访问第二个。所以我想我必须在某个地方调整一个设置才能启用它。
解决方案
最后,我编写了支持,并与他们一起创建了一个新的数据库服务器并复制了数据库。这样它就起作用了。
推荐阅读
- python - 如何在python中获取数组中的最高数值
- java - JAVA,如何在jar环境中获取目录中所有文件名的列表?
- r - 在 R 中使用 XML 文件创建适当的数据框
- java - stdin redirect java process running docker build
- rest - v-model 并将参数传递给休息补丁 api 调用
- excel - EPPlus 改变细胞内部颜色
- terraform - 将 `aws_acm_certificate` 资源添加到 terraform 文件会导致 terraform 忽略 vars
- php - 如何使用 preg_replace 替换不同分隔符之间的文本 () {} [] <> 以及如何在需要时对这些分隔符进行转义?
- javascript - TypeError:无法读取反应中未定义的属性“toLowerCase”
- javascript - 打字稿允许 arguments.callee.name?