2

I have successfully created an Hybrid Connection between Azure and an on-premise resource. I see "Connected" in both the Azure Portal and Hybrid Connection Manager.

When I run my .NET code local in Visual Studio with the connection string "AppServer://MyPC:5162/AzureOeApi" everything runs fine but when I run it in Azure, I get a connection error (it can't see the on-prem end-point).

Do I need to change my connection string when running in Azure to force it to go through the Hybrid Connection or will it be handled automatically?

Richard Butterwood
  • 735
  • 1
  • 12
  • 29

2 Answers2

2

No need to change connection string.

We had similar issue - connection was "Connected", but no requests whould go through. You need to use fully qualified domain name in configuration of hybrid connection.

Please also read this question - similar question

maciek
  • 521
  • 1
  • 4
  • 18
1

I've been struggling with this problem for a whole day and finally I had a breakthrough: in my original connection string I was referring to [DB_SERVER]\[INSTANCE], having correctly configured the DB instance to listen to a given TCP port [PORT].

With this setup the Hybrid Connection was 'Connected' but I was getting the exception:

ExceptionMessage: The underlying provider failed on Open. -InnerExceptionMessage: 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

It turns out that the connection string needs do explicitly refer to the port number (instead of the DB instance) using the syntax [DB_SERVER],[PORT] (mind the comma!).

Unfortunately Microsoft does not document this subtle detail....

NiceGuyAlberto
  • 402
  • 4
  • 6