如何将Azure SQL托管实例连接到Azure App Service(用.NET Core 2.2编写)

问题描述 投票:0回答:1

我有一个.NET Core 2.2 Web应用程序部署到Azure App Service,我正在连接到Azure SQL托管实例。应该在Appsettings.json中写入的连接字符串应该是什么。我尝试了在Azure门户中找到的以下连接字符串,但该字符串不起作用。

"AZURESQLCONNSTR_":Server=tcp:azure-abcde.database.windows.net,1433;Persist Security Info=False;User ID=userid;Password=password;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

但是当我尝试运行以下Azure应用服务时,我没有任何数据。

http://productwebapp.azurewebsites.net/api/ProductDetails/GetProductDetails.

您能否建议解决此问题的方法?

azure connection-string azure-app-service-envrmnt azure-sql-managed-instance
1个回答
0
投票

您将必须允许某些IP地址连接到它。查看SQL数据库服务器的防火墙设置。您可以通过计算机的IP地址(或IP范围)来访问SQL数据库

确保启用允许Azure服务和资源访问服务器

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.