[英]Windows Azure Website connect external SQL server
I just upload my project to Windows Azure website free version . 我只是将我的项目上传到Windows Azure网站免费版 。
My website need to connect to external SQL server on another web hosting.(not SQL server on windows azure). 我的网站需要连接到另一个Web托管上的外部SQL服务器。(不是Windows Azure上的SQL服务器)。
When i develop on my PC. 当我在我的电脑上开发时。 Everything works well (that mean my connection string is correct).
一切都很好(这意味着我的连接字符串是正确的)。
But when i upload to windows azure. 但是当我上传到windows azure时。 It can't connect to that database.
它无法连接到该数据库。
And throw exception like this. 抛出这样的异常。
Access is denied 访问被拒绝
when i do the following this answer, error show like this Connecting to remote SQL Server 2008 from Windows Azure 当我执行以下此答案时,错误显示如此从Windows Azure连接到远程SQL Server 2008
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应
and both show stack trace like this 并且都显示像这样的堆栈跟踪
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
[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.
how can i solve this issue, please help. 我该如何解决这个问题,请帮忙。
You're uploading your application to a Windows Azure Website. 您正在将应用程序上载到Windows Azure网站。 Most probably port 1433 that connects to SQL Server is blocked by default on their firewall.
最可能的端口1433连接到SQL Server在其防火墙上默认被阻止。 Since you're using an azure website you will have no control over this firewall setting.
由于您使用的是azure网站,因此无法控制此防火墙设置。
You can either: 你可以:
I would simply move everything to SQL Azure, it's pretty straightforward. 我只想把所有东西都移到SQL Azure,这非常简单。
If you can add a website to the remote host where the database is hosted, can you create a service (eg WCF or Rest) on that same host that allows you to talk to the database? 如果您可以将网站添加到托管数据库的远程主机,您是否可以在允许您与数据库通信的同一主机上创建服务(例如WCF或Rest)? That way you can still host the database on the external host and communicate with it via the service from the Azure Website.
这样,您仍然可以在外部主机上托管数据库,并通过Azure网站上的服务与其进行通信。
Looks like there's a new way to allow Azure webapps to connect to on premises SQL Servers using Hybrid Connections. 看起来有一种新方法允许Azure Web应用程序使用混合连接连接到本地SQL Server。 Google leads me to believe that this feature became available sometime in 2016. It will require that you install additional software on the machine that hosts your SQL Server instance.
Google让我相信这个功能在2016年的某个时候可用。它需要您在托管SQL Server实例的计算机上安装其他软件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.