Azure Hybrid Connection with Entity Framework Connection failure

1

I'm attempting to publish an ASP.net web app to the Azure cloud. I have to use a hybrid connection to talk with one of my SQL Servers. I believe I have it all set up correctly; however, my entity framework connection string does not appear to work.

This is what my hybrid connection string looks like in the Azure portal under the respective Azure App Service:

Name: serverdev
Status: Connected
Endpoint: ipaddress:49188
Namespace: serverCon

This is what the Hybrid Connection Manager looks like on the target SQL Server:

Name: serverDev
Azure Status: Connected
Service Type: Relay
Service Name: serverCon
Endpoint: ipaddress:49188
Service Bus Endpoint: serverCon.servicebus.windows.net
AzureIP Address: azureIpAdress
AzurePorts: 80,443

So, it looks like the hybrid connection is configured correctly.

Here is what my Entity Framework connection string looks like in my web.config:

<add name="EDUONNWEntities" connectionString="metadata=res://*/DBModels.WarehouseModel.csdl|res://*/DBModels.WarehouseModel.ssdl|res://*/DBModels.WarehouseModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;connectionString;initial catalog=EDUONNW;persist security info=True;user id=username;password=password;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />
Note: connectionString = to the connection string of my sql server when testing my web app outside of the cloud (on my local dev machine, everything works fine of course).

Here is the exception that I receive:

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. (provider: TCP Provider, error: 0 - No such host is known.)

It seems to me that my Azure App Service does not know to use the hybrid connection based on my Entity Framework connection string. I feel as I'm missing something easy. Any help is appreciated!

Thank you, Snawwz

asp.net-mvc
azure
entity-framework-6
azureportal
azure-hybrid-connections
asked on Stack Overflow May 31, 2018 by Ruben • edited May 31, 2018 by Ruben

1 Answer

0

I do realize this is an old post but I am responding in case anyone else was struggling with this. I had a similar issue and to fix it, I had to set the connection strings of my entities in the publishing options:

Connection String:
Connection String

answered on Stack Overflow Jan 20, 2020 by Eugene Chan • edited Jan 20, 2020 by Dharman

User contributions licensed under CC BY-SA 3.0