连接到外部SQL Server数据库 [英] Connect to external SQL Server database

查看:345
本文介绍了连接到外部SQL Server数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经设置了一个新的App Service网站(ASP.NET网站)并尝试连接到使用Crazy Domain Windows托管进行外部SQL Server数据库设置。





$
我去了"自定义"域"部分并获取IP地址并将其设置在外部SQL Server的防火墙上以允许访问。但是,当我的网站尝试连接到数据库时,我收到以下错误:



---
$
b $ b SQL测试连接失败。建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,并且SQL Server配置为允许
远程连接。 (提供者:命名管道提供程序,错误:40 - 无法打开与SQL Server的连接)



---



问题似乎与防火墙有关,但IP地址已经添加。 SQL Server上的端口1433也应该打开,因为我可以从本地PC的SSMS访问数据库。此外,该数据库是一个实时数据库,运行超过一年的



有人可以请帮助并对这种特殊情况有所启​​发?找到问题并解决问题会很棒,这样我的Azure App Service就可以与外部SQL Server通信了。




提前致谢。


Andrew

解决方案

Hello Andrew,


该问题看起来像配置问题。请尝试以下


打开SQL Server配置管理器。在左窗格中展开"SQL Server网络配置",然后选择要连接到的SQL Server实例。右侧窗格列出了可用的连接协议。要从
另一台计算机连接到SQL Server,通常使用TCP / IP。如果未启用TCP / IP,请右键单击"TCP / IP",然后单击"启用"。重新启动数据库引擎(在左侧窗格中选择SQL Server Services。在右窗格中,右键单击数据库引擎的实例,
,然后单击"重新启动")



Hi,

I've setup a new App Service website (ASP.NET website) and tried to connect to an external SQL Server database setup with Crazy Domain Windows hosting.



I went to "Custom Domain" section and got the IP address and set it up on the external SQL Server's firewall to allow access. However, when my website tries to connect to the database, I got the error below:

---

SQL Test Connection Failed. 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

---

The issue seems related to firewall, but the IP address was already added. The port 1433 on the SQL Server should've been opened as well, because I can access the database from my local PC's SSMS. In addition, the database is a live database, and it has been running for more than a year.

Can someone please help and shine some light on this particular situation? It would be great to locate the issue and resolve it, so that my Azure App Service can talk to the external SQL Server.

Thanks in advance.

Andrew

解决方案

Hello Andrew,

The issue looks like a configuration issue. Try the following

Open SQL Server Configuration Manager. In the left pane expand SQL Server Network Configuration, and then select the instance of SQL Server that you want to connect to. The right-pane lists the connection protocols available. To connect to SQL Server from another computer you will normally use TCP/IP. If TCP/IP is not enabled, right-click TCP/IP, and then click Enable. Restart the Database Engine (In the left pane select SQL Server Services. In the right-pane, right-click the instance of the Database Engine, and then click Restart)


这篇关于连接到外部SQL Server数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆