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="connectionString;initial catalog=EDUONNW;persist security info=True;user id=username;password=password;multipleactiveresultsets=True;application name=EntityFramework"" 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
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:
User contributions licensed under CC BY-SA 3.0