1
votes

We have setup our VPN connection in Azure to our on-premises database, the connect is working with no problems. I have written a MVC app that tries to connect to our on-premise database in SQL Server and am getting the following error:

System.Data.SqlClient.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. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

The connection string I am using is:

name="productdbConnectionString" connectionString="Data Source=172.16.x.xx,1433;Initial Catalog=productdb;User Id=poppy;Password=poppyxxxxx" providerName="System.Data.SqlClient"

I have opened TCP and named pipes and I am using port 1433 in the connection string so am a bit confused why I cannot access the database?

1
where's the app hosted?4c74356b41
Hi the app is hosted in azure, so we have the sql database hosted on premise and app hosted in Azureuser142617
no i mean, is it a webapp or just a service in a vm or what?4c74356b41
From the kudu console can you do tcping youripadress 1433 and see if you can communicate from azure vpn.Mitul
Just in case this point was overlooked - for a App Service 'Web App' VNET integration is available only in the Standard and Premium plans. Check this link for more info - docs.microsoft.com/en-gb/azure/app-service-web/…alwayslearning

1 Answers

2
votes

We could connect the web app to local on-premises SQL Server database using the Hybrid Connection feature. Please refer to this documentation that explained how to connect to on-premises SQL Server from a web app in Azure App Service using Hybrid Connections.