A connection was successfully established with the server, but then an error occurred during the login process

Kailash Chandra Behera | Saturday, October 10, 2020

Introduction

Recently I faced this. Suddenly we face this issue even there is no change in application, no path deployed and nothing our operation team has changed in application file as well. This is basically connectivity issue between application and SQL server.

This blog helps to fix an issue that occurs when an application tries to open a connection to a SQL Server.

Getting Started

You may get one of the following error messages is displayed when your application tries to open a connection to a SQL Server. Do not worry about your application, your application is ok. Change are done in Microsoft Network setting.

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

  2. A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

Reason of this

This issue occurs when an application running on Windows Server 2012 R2 tries to connect to SQL Server running on Windows Server 2019. Depending on the provider or driver that you're using, the error message may slightly vary.

Windows 10, version 1511 and later versions of Windows, including Window Server 2016 or Windows 10, version 1607 that has updates released on Feb 25thor later updates installed, contains a leading zero update. Meanwhile, all Windows versions that released before that don't contain the leading zero updates.

The TLS client and server need to calculate keys exactly in the same way otherwise they get different results. TLS connections randomly fail if leading zeros are computed differently by the TLS client and TLS Servers.

Solution

Make sure that both the client and server involved in a connection are running Windows that have the leading zero fixes for TLS_DHE installed. You need to install the Windows update that has fixed the TLS_0 or uninstall the update recently installed in your machine that don't contain the leading zero fixes for TLS_DHE

Click on the blow error that your are facing which guides how to resolve this issue.

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

  2. A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

Summary

I hope this content helped you the understand the error and you able to sort out your problem. Again I hope that you have enjoyed it a lot.

Thanks


No comments: