从Azure Web应用连接到Prem SQL Server

问题描述:

我在最初有.Net应用程序.我想将其托管在Azure上,但不想移动数据库.我在Azure上发布了该应用程序,但无法连接到主数据库.

I have .Net application at on prim. I want to host it at Azure but don't want to move database. I publish the application on Azure but it is not able to connect to on prim database.

SQL服务器位于私有网络中.

SQL server is in private netwrok.

出于POC目的,我正在使用MSDN订阅.我面临以下错误,

For POC purpose, I am using MSDN subscription. I am facing below error,

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

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)

谢谢,Umesh

由于内部部署数据库位于私有内部部署网络中,Azure服务找不到该数据库,因此可以公开内部部署的公共IP数据库或使用Azure Web应用程序服务 VNet集成 Azure VPN网关以安全地访问Azure VNet或本地网络中的资源.

Since your on-premise database is in your private on-premise network, Azure service could not find it, you could expose a public IP for the on-premise database or use Azure web app service VNet integration with Azure VPN gateway to securely access the resource in an Azure VNet or on-premise network.

另一种推荐的方法是使用 AzureApp Service混合连接.为此,您需要在您的应用中添加并创建混合连接.您将在数据库服务器或与本地数据库位于同一网络的另一台服务器中下载并安装代理(Hybrid Connection Manager).

Another recommended method is to use an Azure App Service Hybrid Connections. To do this, you need to add and create Hybrid Connections in your app. You will download and install an agent (the Hybrid Connection Manager) in the database server or another server which is in the same network as the on-premise database.

主要步骤如下:

  1. 您在应用程序服务或网络应用程序上配置逻辑连接.
  2. 已下载小型代理程序Hybrid Connection Manager,并将其安装在远程运行的Windows Server(2012或更高版本)上您需要与之通信的网络(本地或任何地方).
  3. 您在混合连接管理器中登录Azure订阅,然后在应用程序服务中选择逻辑连接.
  4. Hybrid Connection Manager将启动到您的Azure应用服务的安全隧道(TCP 80/443).
  5. 您的应用程序服务现在可以通过Hybrid Connection与Windows或Linux上的远程网络中基于TCP的服务进行通信经理.

您可以获得有关如何将Azure Web Apps连接到本地的更多详细信息.