0

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).

Dale K
  • 25,246
  • 15
  • 42
  • 71
  • Note that the SQL Server browser service uses UDP, and Hybrid Connection does not support UDP. Perhaps read this section on troubleshooting first : https://learn.microsoft.com/en-us/azure/app-service/app-service-hybrid-connections#troubleshooting – Nick.Mc Dec 08 '20 at 23:59
  • There's also a guide here with constraints. For example your SQL Server needs to be on a static port. https://github.com/Huachao/azure-content/blob/master/articles/app-service-web/web-sites-hybrid-connection-connect-on-premises-sql-server.md – Nick.Mc Dec 09 '20 at 00:02
  • Thanks for the comments! In my specific case, it was because I need to open port on my VM due to company security policy. Opening port solves the issue. – Alex Qiang Dec 11 '20 at 00:00
  • It's strange that you still managed to connect 5% of the time. I guess the port you mentioned is the outgoing one mentioned in the official doc. Glad you sorted it. – Nick.Mc Dec 11 '20 at 00:30

1 Answers1

0

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.

Lucky
  • 16
  • 1
  • I have came across this doc as well. Thanks for it! In my specific case, it was because I need to open port on my VM due to company security policy. Opening port solves the issue. – Alex Qiang Dec 11 '20 at 00:02