sql-server - 等待操作从 Azure Function App 建立到 SQL Server 的连接超时

标签 sql-server azure

我正在 Azure 中构建函数应用程序,并尝试连接到第三方 SQL Server。我在函数的应用程序设置中添加了如下连接字符串:

Server=[servername],1433;Initial Catalog=[dbname];Persist Security Info=False;
User ID=[myuser];Password=[mypassword];MultipleActiveResultSets=False;
Encrypt=False;TrustServerCertificate=True;Connection Timeout=30;

当然,我用实际值替换了 [] 上的字符串,但是每次我尝试连接到服务器时都会收到此错误:

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 - The wait operation timed out.)

System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

当我尝试使用本地 Management Studio 中的相同凭据连接到同一服务器时,它可以正确连接,那么我在 Azure 连接中做错了什么?

感谢您的投入!

最佳答案

您的连接字符串看起来正确。该错误表明存在连接问题。如果它在本地 SSMS 上运行,我必须问一个显而易见的问题 - 它是本地 SQL 数据库还是 Azure 中的 SQL Azure 数据库?如果它是本地部署的,则除非设置混合连接或快速路由,否则您将无法从 Azure 连接到它。如果它在 Azure 中,您可能的服务器名称错误。 SQL Azure 数据库的主机名附有 *.database.windows.net。

关于sql-server - 等待操作从 Azure Function App 建立到 SQL Server 的连接超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52012982/

相关文章:

mysql - SQL删除更新外键主键约束

SQL将float转换为带小数的逗号varchar

azure - 选择现有资源组会出现错误

azure - 使用 Terraform random_id 创建多个资源未按预期工作

Azure WebRole + Flask : AttributeError: 'module' object has no attribute 'wsgi_app'

sql - 在 CREATE TABLE 语句中使用用户定义的函数

sql - 无法从 VS 2012 找到 SQL Server 的 dll

sql-server - 故障转移群集上的 SQL Server 2008 Reporting Services

azure - 分布式交换操作<ShuffleMoveOperation>

azure - 有没有办法使用 Azure Devops 将 yaml 构建管道转换为发布管道?