I am getting following error when i am trying to connect Production DB from Local Environment.
I was able to connect Production DB before, but suddenly i am getting f
In my case, i was getting the error when i wanted to access a remote database. However, i solved it by starting SQL Server Browser service.
You might want to check a few things:
You production server allows remote connections. (possible that someone turned this off, especially if you have a DBA)
Check your connection string. Sometimes if you are using an ip address or server name this will cause this error. Try both.
Tried most of the above and nothing worked. Then turned off the VPN software (NordVPN) and everything was fine.
I had a similar issue where I couldn't connect to a database and tried the recommendations here.
At the end of the day this is what worked for me:
Used the SQL Server Configuration Manager tool to enable the TCP/IP and/or the Named Pipes protocols on the SQL Server client computer.
I am still not sure why or when this was disabled.
I experienced this error when running some very memory-expensive processes. When the system started to run short of memory, I begun to notice this kind of error. I had to change the algorithm in order to make a better use of RAM.
To be noted that while some threads threw this exception, some other threw:
System.Data.SqlClient.SqlException (0x80131904): Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=43606; handshake=560; ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
Both problems disappeared after the system was changed so that it could run using less RAM.
I had the same problem, I was storing session data in the database, the connection string had Encrypt=True in it, which I assume told the sql client to connect to the server in secure (SSL) mode, removing this helped!