简体   繁体   English

无法从Azure API连接到SQL Server

[英]Unable to connect to SQL Server from Azure API

I am developing an API which will be hosted in Azure app services. 我正在开发一个将在Azure应用服务中托管的API。 This api should fetch data from a SQL Server which is outside the Azure subscription. 此api应从Azure订阅之外的SQL Server获取数据。 It uses SQL Server authentication to connect. 它使用SQL Server身份验证进行连接。 Everything is working fine from my local machine, but when published to Azure, it is not getting connected and throws this error 从本地计算机上一切正常,但是当发布到Azure时,它没有连接并抛出此错误

.Net SqlClient Data Provider .Net SqlClient数据提供程序
number: 5, state: 0, errorClass: 20, server:"", number:5,state:0,errorClass:20,server:“”,

A network-related or instance-specific error occurred while establishing a connection to SQL Server. 建立与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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) 验证实例名称是否正确以及SQL Server是否配置为允许远程连接。**(提供程序:命名管道提供程序,错误:40 - 无法打开与SQL Server的连接)

Please ensure you SQL server has opened the remote connection. 请确保SQL Server已打开远程连接。

Right click SQL server-- Properties , select Connections : 右键单击SQL server-- Properties ,选择Connections

在此输入图像描述

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM