Search code examples
sql-serverazure-appserviceazure-hybrid-connections

Azure app service with hybrid connection can't access on prem SQL Server


I have an app service with hybrid connection enabled(on a VM in the same network with the SQL Sever) for me to access on prem SQL Server, which I don't own. However, the connectivity has been pretty unstable.

I am able to access to the SQL Server probably for maybe 5% of the tries and mostly I just get error

One or more errors occurred. (A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.

I'm able to log in thru SSMS on the VM. Connection string should be alright since I can access locally(local network is the same network as the SQL Server).


Solution

  • Named instances use dynamic ports and UDP, which are not supported by Hybrid Connections. Suggest you using static port as Nick mentioned. Please refer to this document Connect to on-premises SQL Server from a web app in Azure App Service using Hybrid Connections to get more information.

    provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.

    What is your Windows version? When Windows versions that don't contain the leading zero fixes for TLS_DHE will display this error message. You can try to update windows version or disable the TLS_DHE ciphers to solve this issue. Please refer to this document.