I was running SQL Server 2017 CTP on my local Win10 box and I woke up today and it said my eval has expired. So I downloaded SQL Server Standard from MSDN.
Fix attempt #1: I downloaded SQL Server Standard from MSDN and on SQL Server Installation Center I chose the Maintenance option.
It asked my which instance I want to upgrade and I chose the instance that had expired. I followed all the instructions and it says it was successful but when I try to start the instance, the event log shows the same error
SQL Server evaluation period has expired
Fix attempt #2: I download SQL Server 2017 Enterprise and from the SQL Server Installation Center I chose "Upgrade from a previous version of SQL Server".
I got through the install steps until I got to the Feature Rules check where it bombed on SQL Server Service Health Check with this error:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake (provider: SSL Provider, error: 0 - The message received was unexpected or badly formatted).
Do I have to uninstall?
Is the only way to upgrade an eval SQL Server instance by wiping it out? If so, what's the safest way to remove it?
I had this answer in production trying to upgrade to enterprise, whereas in test it was just fine. It failed at the same spot but I believe the issue was that apps were continuously writing to the DB. So I had to actually remove the external IP address and reboot and at that point it was fine.
Today I could not log into my local SQL Server 2012 instance with the following error message
A connection was successfully established with the server, but then an error occurred during the pre-login handshake.
provider: SSL Provider, error: 0 - An internal error occurred.
(Microsoft SQL Server, Error: -2146893792)
I found many similar questions here and on the forums, but nothing helped. Please notice that in my case it just says
0 - An internal error occurred
There are no errors in Event Viewer;
I don't use Encrypted Connections;
In SQL Server Configuration Manager, Force Protocol Entryption is set to False, Trust Server Certificate is set to Yes (Originally it was No, but in both cases it didn't work);
I CAN connect to SQL Server using UDL;
I tried to re-install SQL Server with all related components;
Tried to uninstall .NET 4.5;
In SQL Management Studio, in connection properties, Encrypt Connection is unchecked.
It worked fine yesterday, I have not installed any software since then.
check that TCP/IP protocol is not enabled for clients. Without TCP/IP protocol you can not access the sql server from other clients. Following is the method to enable the protocol.
Go to the: Start-->Programs-->SQL Server--> Configuration Tools-->SQL Configuration Manager.
Expand the SQL Network Configuration and click on the PROTOCOLS node
Right click on TCP/IP and open up the PROPERTIES panel
Select the IP ADDRESS tab
http://sqlanddotnetdevelopment.blogspot.in/2013/07/a-connection-was-successfully.html
In our case it was the problem with the SSL/TLS. We just disabled tls 1.0 to make sure we were compliant with PCI DSS but it stopped SQL Server. Then we had to install one update from Microsoft and then did the disable thing using IISCrypto instead of using the registry. Here's the steps we followed:
https://www.itechtics.com/connection-successfully-established-error-occured-pre-login-handshake/
I got this error connecting to localhost with the newest version of Microsoft.Data.SqlClient.
Turns out that Microsoft really wants you to encrypt your database, for security.
This can be fixed client side by changing the connection string, by adding an Encrypt=False parameter, eg:
SERVER=.\SQLEXPRESS;DATABASE=MyDatabase;Integrated Security=True;Encrypt=False;
See Rick strah's blog post on the subject
In our case same error occurred due to spn not set.Try checking if spn is set. As others suggested in comments you can see ring buffer entries which holds more info .if you are able to repro more often try running netmon or wireshark in parallel
None of this stuff worked for me.. in the end I had to install the cumulative update for SQL Server 2014 SP1
SQL Server Cumulative Updates
In my case the error was fixed by adding "Encrypt=False" like this:
Server=localhost\\SQLEXPRESS;Database=*YOUR_DATABASE*;Trusted_Connection=True;Encrypt=False
Disable TLS 1.2 protocol and enabled 1.0 /1.1 . Re-installed SQL server post restarting the server
I have been using SSMS and LinqPad both for months to connect to SQL Azure instances without issue. Suddenly this week, linqpad stopped connecting, consistently timing out and displaying this error message: "A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - the wait operation timed out.)"
At first, it was just LinqPad. But soon after I started experiencing the same issue with SSMS 2012. It showed the exact same error message (slightly different dialog).
I've confirmed that this isn't a firewall rule issue. My IP has been allowed through the SQL firewall for months, and I can still connect using the same credentials using SQLCMD and I can run queries.
Any ideas? Why would SSMS and LinqPad both take a big dump while SQLCMD still works?
I finally found the solution to this (I think I may have found it via https://stackoverflow.com/questions/13420770/pre-login-handshake-error-connecting-directly-to-sql-azure). I installed some completely unrelated software about the time that things stopped working. As it happens, said software also installs - silently - some bundled software that leaves you with custom Winsock LSPs in place, which means the system is then afflicted by an issue reported to Microsoft and addressed in KB 2568167. Fortunately, I didn't have to manually remove the LSPs because I was able to uninstall the unwelcome software (Sendori!).
Did you look at the connectivity troubleshooting guide for SQL Azure?
http://social.technet.microsoft.com/wiki/contents/articles/1719.windows-azure-sql-database-connectivity-troubleshooting-guide.aspx
Have you also installed .NET 4.5 recently/in that week time frame? Have you checked your SQL Connection to make sure that SSL encryption is off?
Yes folks, it's this one again.
"A connection was successfully established with the server, but then
an error occurred during the login process (provider: TCP Provider,
error: 0 - An existing connection was forcibly closed by the remote
host.)"
I'm sorry... I have Google'd this, I have read the other StackOverflow articles on this problem, and I have tried all kinds of suggestions, but nothing works.
Here's a few notes about what we're seeing.
This issue occurs occassionally in SQL Server Management Studio itself (doing any kind of database activity... getting a list of tables in a database, having a look at a Stored Procedure, etc)
It also happens in Visual Studio 2010 itself, when it is trying to get data from the servers (e.g. when creating a .dbml file, etc)
It also sometimes happens in our .Net (ASP, WPF, Silverlight) applications.
Our SQL Server 2005 & 2008 servers are all based on virtual machines in data centres around the world, and we see sometimes this error on each of them. But most of the time, they all work absolutely fine.
When the error does occur, we can just "retry" what caused the error, and then it'll work fine.
We think.. if we have an IIS Web Server in a data centre in a particular city, and it accesses a SQL Server in the same data centre, then we don't see the issue.
We think.. if we connect to the servers, and specify the UserID and Password to use, it causes this error much more frequently than if we just use Active Directory authentication.
Put all that together, and it sounds to me like some kind of network issue.
But can anyone suggest what to look for ?
This isn't a bug in our .Net applications, as even SQL Server Management Studio "trips up" with this error.
It's baffling us.
Just in case anyone else hits this issue, we finally found the solution.
Our company uses Riverbed software to compress data, when it's being passed between locations, and this was somehow causing some connections to get dropped.
Our IT gurus found a configuration setting which finally fixed this issue.
I believe there's a setting in there to turn off compressing results from SQL Server (or something like that). That fixed it for us.
It could be any number of network issues. ANYTHING that prevents the code from reaching the server even for the few miliseconds it takes to make one query.
it could also be the result of a failover. When we went from a single SQL Server to a clustered environment, we'd see this happen during a failover. In this case, it turned out to be our Connection Pooling. In essence, the SQL cluster has a controller and two servers behind it. A and B.
Say our web app is using server A just fine, Connection pooling creates a connection on both sides. The server is aware of it, and the web app is aware of it. Once the cluster fails over to the second server, the web app is aware of the connection but server B is not, so we get an error.
The point is, any possible cause of network issues imaginable may be the cause. DOS attacks on the server, man-in-the middle attacks intercepting and changing traffic. Someone trips on an ethernet cable and it's loose in the jack. You name it, if it can cause a connection issue, it could be the cause.
Your issue also sounds like one we had recently - we also have a virtual environment, wih software that moves VMs from one host to another as needed for load balancing. Every so often, we'd get bombarded with the same error. It turned out to be an issue with the NIC drivers on one of the hosts, so whenever a VM moved to that particular host, errors would occur.
It's really not a programming issue. It's an environment issue, and you need trained professionals with direct access to your environment to research and resolve this.
My problem was that I was inadvertently using a wireless network to connect to our network because the Ethernet cable was faulty. This after repairing SQL Server, running a Winsock reset as recommended elsewhere ...
I am experiencing the same issue and our app interfaces with a several Azure SQL DBs. I believe (same as you) I do not have a bug in the C# code to cause this issue. We've solved it by a simple for loop containing an extra attempts to try to connect to the Azure SQL again if the previous attempt fails and then run the query.
Most of the time everything runs fine but sometimes we can see the loop kicked-in and on the 2nd or 3rd time it executed properly without the below mentioned error. After that we see in the log file the error below for all the unsuccessful attempts:
A connection was successfully established with the server,
but then an error occurred during the login process. (provider: TCP
Provider, error: 0 - An existing connection was forcibly closed by the
remote host.)
Even though this is a less-then-pretty solution, it allowed us to run our app without interruptions. I know you've mentioned that trying to connect again (to introduce some connection-failure tolerance) solves the problem and unfortunately this is the only correct solution I found so far as well.
I should mention that we have tried many debugging strategies to figure this out. Right now it all points to the availability of the database we are trying to connect to i.e.: It happens if the number of allowed DB connections is exceeded. (or so it seems at this time)
Turn off your VPN
My Problem fixed by turn off VPN
It was happening in our code when we were opening the dbconnection for oracle and were passing DBtype as SQL in our database object.
in my case - the error was Microsoft first suggestion:
Client is connecting with an unsupported version of the SQL Server Native Client.
In our case, We got this error when we updated sql server to sp3. We were not able to connect to the database from SSIS package.
We updated the native client and configurations. We were able to connect.
link to download the native client - https://www.microsoft.com/en-us/download/confirmation.aspx?id=50402
Link for configurations settings and further troubleshooting - https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms187005(v=sql.105)
Hope it helps.
Cheers!
Had the same type of issue. In my case it was a bit more complicated... I could connect to “ServerA” from “ServerB” via SSMS, but it would fail with sqlcmd. The error was the same:
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : TCP Provider: An existing connection was forcibly closed by the remote host.
I could also connect from “ServerC” with both SSMS and sqlcmd. The following are the versions on the VMs:
ServerA: Microsoft Windows Server 2012 R2 Datacenter / Microsoft SQL Server 2012 (SP3-CU10) (KB4025925) - 11.0.6607.3 (X64)
ServerB: Microsoft Windows Server 2012 R2 Datacenter / Microsoft SQL Server 2012 - 11.0.5058.0 (X64)
ServerC: Microsoft Windows Server 2012 R2 Datacenter / Microsoft SQL Server 2012 (SP3-CU10) (KB4025925) - 11.0.6607.3 (X64)
Bottom line was the “unsupported version”. I noticed a mismatch of “sqlncli11.dll” between ServerC and ServerB, so I copied it to the System32 folder. After this, sqlcmd worked like a charm. Below were the versions in my case:
Failed:
FileVersion: 2011.0110.5058.00
ProductVersion: 11.0.5058.0
Worked:
FileVersion: 2011.0110.6607.03
ProductVersion: 11.0.6607.3
I was working on 2 projects at the same time (on 2 different machines) and both used SQL Server.
When i disconnected SQL with 1 machine the errorMessage went away. Probably you can mess around with IP-adresses too to fix the problem.
In my case I was seeing this error intermittently from a .Net application connecting to a SQL server located in the same server room. It turned out that some of the databases had auto close turned on which caused the server to close the connections in the pool. When the application tried to use one of the pool connections that had been closed, it would throw this error and I saw a log message on the SQL server that the database it was trying to connect to was being started. Auto-close has now been turned off on those databases and the error hasn't been seen since.
Also, having auto-close on is the default behavior for SQL Express databases and these were originally created on an Express instance during testing before being migrated to the production server where we were seeing the errors.
this answer is for those how have this problem with Azure Sql server database.
It happens when you reach mat pool
first remove Persist Security Info=False from connection string
second check your database plan in azure portal and increase the PTUs of your database plan.
In SSMS "Connect to Server" screen click Options, then on "Connection Properties" TAB change "Network protocol" to "Named Pipes"
Try this -
Click Start, point to All Programs, and click SQL Server Configuration Manager.
Click to expand SQL Server Network Configuration and then click Client Protocols.
Right-click the TCP/IP protocol and then click Enable.
Right-click the Named Pipes protocol and then click Enable.
Restart the SQL server service if prompted to do so.
I have had this issue a couple of time already, and I've fixed by reducing the MTU size. Often 1350, 1250, etc on my network interface.
I am getting an error while connecting sql express server 2005 over the network.
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.
I have tried following things.
1. Allow remote connection along with both TCP and named pipe checked in both (target and initiator machine) in surface configuration manager.
2. sql browser is on automatic mode and running on both the machines.
Still I am not able to connect to machine.
I could see the server name (without "/sqlexpress") with the list but not able to connect.
I think if it could start showing TargetServer/sqlexpress then I could connect it easily.
Please guide me if I am missing anything.
Thanks in advance.
Anil
This is a pretty common problem, because by default, the remote support is turned off, and firewalling is enabled, so turning on the service doesn't always open the port.
Have a look at the answer to this MSDN question
Also check the authentication method - this is usually my problem. Eg. Windows Authentication across OS types or different usernames.