The connection was successfully established with the server, but then an error occurred during the handshake before entering the system

I get the following error when I try to connect a production database from a local environment.

I managed to connect Production DB before, but suddenly I get the following error, any idea?

The connection to the server was successfully established, but then an error occurred while establishing a connection with the preliminary connection. (provider: TCP provider, error: 0 - handle is invalid.)

I tried to run the asp.net site on a local PC that has a production database connection string, the next one is a stack trace for the error I get in the local environment.

in MyWebsiteDAL.clsForumQuestion.SelectAll (Int32 CurrentPageIndex, Int32 PageSize) in D: \ EDrive \ My Websites \ MyWebsite \ MyWebsite \ MyWebsiteDAL \ clsForumQuestion.cs: line 821 in the CodeConnect.Default.Page_Loadgs object (sender) D: \ EDrive \ My WebSites \ MyWebsite \ MyWebsite \ MyWebsite \ Default.aspx.cs: line 100 in System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) in System.Web. Util.CalliEventHandlerDelegateProxy.Callback (object sender, EventArgs e) in System.Web.UI.Control.OnLoad (EventArgs e) in System.Web.UI.Control.LoadRecursive () in System.Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Any idea what could go wrong here?

+100
sql-server sql-server-2008 database-connection
Jul 17 '10 at 4:01
source share
17 answers

Decision

1) Clean VS.Net Solution

2) Rebuild the project.

3) Reset IIS

4) Run the project again.

Basically, that solved my problem, but in my case I did not get this error, and suddenly my local environment starts to give me the above errors, so maybe this trick works for me.

+146
Jul 17 '10 at 4:21
source share

- I saved my work,
- Closed Visual Studio, then
- Reopened my project

Always works for me.

+13
Feb 06 '14 at 10:07
source share

I experienced this error when starting some very expensive processes. When the system began to run out of memory, I began to notice such an error. I had to change the algorithm to make better use of RAM.

It should be noted that while some threads threw this exception, some others threw:

System.Data.SqlClient.SqlException (0x80131904): The connection timed out. The waiting period has expired while trying to use an authorization confirmation confirmation before entering the system. This may be due to the fact that the handshake before entering the system failed or the server was unable to respond on time. The duration spent trying to connect to this server was - [Pre-Login] initialization = 43606; acknowledgment = 560; ---> System.ComponentModel.Win32Exception (0x80004005): timeout waiting

Both problems disappeared after changing the system so that it could work with less RAM.

+9
Aug 19 '15 at 9:18
source share

The following command worked for me:

netsh Winsock reset 

In the field https://serverfault.com/a/487139/250527

+8
Oct 23 '14 at 15:51
source share

You might want to check out a few things:

  • Production server allows remote connections. (maybe someone has disabled this, especially if you have a DBA)

  • Check the connection string. Sometimes, if you use the IP address or server name, this will result in this error. Try both.

+5
Dec 05 '10 at 3:45
source share

I had the same problem: I stored the session data in the database, the connection string had Encrypt = True , and I assume that the sql client connected to the server in secure (SSL), deleting this helped!

+5
Nov 14 '12 at 12:27
source share

In my case, it was:

Persist Security Info=True;

in the connection string to be deleted. As soon as I did this, I had no more problems.

+3
Jun 25 '13 at 17:29
source share

As described in Ricardo's answer,

 netsh Winsock reset 

worked for me

PS , if you have an Internet download manager or programs that change the IP address setting, then after running this command when the computer restarts, IDM will ask you to change the setting, set NO in this case and then run the application, it will work correctly.

Hope he

+3
Jul 25 '15 at 8:35
source share

I had a similar problem when I could not connect to the database and tried the recommendations here.

At the end of the day, this is what worked for me:

The SQL Server Configuration Manager tool is used to enable TCP / IP and / or Named Pipes protocols on the SQL Server client computer.

  • Click Start, select All Programs, and click SQL Server Configuration Manager.
  • Click to expand the SQL Server network configuration, and then click Client Protocols.
  • Right-click TCP / IP and select Enable.
  • Right-click on the Named Pipes protocol and select Enable.
  • Restart the SQL Server service if prompted.

I'm still not sure why or when it is disabled.

+3
Mar 10 '16 at 2:09
source share

For me, the solution is to kill the workflows expressing Zombie IIS.

eg. find in the task manager and complete the task.

enter image description here

+2
Feb 18 '15 at 3:30
source share

I had the same issue and was not lucky with the proposed fixes. Then I came across in this article and saw a comment from Mirrh regarding the Sendori program blocking LSPs. I do not know how this happened on my computer, but there it was and fix the problem.

If the article does not work, just check your programs and uninstall Sendori if you see it.

+1
Jan 09 '13 at 21:19
source share

I restarted the SQL Server service (Sharepoint) and it solved the problem.

+1
Aug 26 '13 at 8:44
source share

I was getting the same problem without chnges to code base or servers. It turned out that the database server is running on a 100% processor, and SQL Server is starving from any processor time, which caused a timeout.

+1
Feb 03 '16 at 3:21
source share

It had the same problem, the reason for it was the BCrypt.Net library compiled using the .NET 2.0 platform, and the whole project that used it was compiling with .NET 4.0. If the symptoms are the same, try downloading the BCrypt source code and rebuild it in the release configuration in .NET 4.0. After I did this, the โ€œhandshake before entryโ€ worked fine. Hope this helps anyone.

0
Oct 03
source share

I experienced this error and made all the suggestions from you guys, but nothing affected my error.

I caught the culprit: if you use the *.ini file for your system, you can check which server name was entered there and make sure that it matches what is indicated in the connection string web.config.

0
Oct 24 '14 at 6:38
source share

The same problem here and no answers listed here worked, nor any solutions that I could find on the Internet. The problem started shortly after the Windows 10-based update was applied to my development computer and affected only my old instance of SQL Server 2005. I could not connect to the instance through my web applications or even using Sql Management Studio.

What it costs for is what resolved this for me:

  • Open SQL Server Configuration Manager (depending on which version of SQL Server you are using):

    • C: \ Windows \ SysWOW64 \ SQLServerManager.msc
    • C: \ Windows \ SysWOW64 \ SQLServerManager10.msc OR
    • C: \ Windows \ SysWOW64 \ SQLServerManager12.msc OR
    • etc.
  • Select SQL Server Services

  • Find the faulty service and view the properties

    • e.g. SQL Server (SQL2005) in my case
  • On the "Login" tab, change "Built-in Account" to "Network Service"

This is almost what this random solution said: http://www.kutayzorlu.com/operating-systems/linux-unix-redhat-debian-ubuntu-opensuse-centos/general-server-administrating/error-fixed-a- connection-was-successfully-established-with-the-server-but-then-an-error-occurred-during-the-pre-login-handshake-12405.html

I chose Network Service for no reason. Mine is already configured to use the local system. This security does not matter to me, because it was problematic only on my local development machine, accessible only locally. I canโ€™t say why this works, but it is.

0
Jun 22 '17 at 15:27
source share

In my case, I was getting an error when I wanted to access a remote database. However, I solved this by starting the SQL Server Browser service.

enter image description here

0
Nov 08 '17 at 6:30
source share



All Articles