1

I have been trying to open my SQL Server database in Server Explorer, and I'm always getting the following error

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=18214; handshake=118555;

I've tried to fix the issue by repairing the VS2019, and that didn't work.

Edit: The database is running locally from my PC. And this is the connection string from Web.config file:

<add name="UserEntities" connectionString="metadata=res://*/Models.UsersModel.csdl|res://*/Models.UsersModel.ssdl|res://*/Models.UsersModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=Mizile;initial catalog=Login;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />
Mizile
  • 134
  • 1
  • 8
  • [Why should I "tag my RDBMS"?](https://meta.stackoverflow.com/questions/388759/why-should-i-tag-my-rdbms) - please add a tag to specify whether you're using `mysql`, `postgresql`, `sql-server`, `oracle` or `db2` - or something else entirely. – marc_s Jan 09 '21 at 17:57
  • Also let us know if the DB is local or on the web, if you can provide the connection string it can help, (replace your personal informations by ***). – B.S. Jan 09 '21 at 18:20
  • @B.S. I just added them. – Mizile Jan 09 '21 at 20:30
  • See this: https://stackoverflow.com/questions/15488922/connection-to-sql-server-works-sometimes – Akira Yamamoto Nov 09 '21 at 04:23

2 Answers2

0

You're connection string is incorrect. If SQL Server is on your machine locally, or on your network then it CAN look something like this,

<add name="UserEntities" connectionString="Data Source=YourSqlInstanceName;Initial Catalog=YourDatabaseName;Integrated Security=True" providerName="System.Data.SqlClient" />

You can of course read MS docs about different types too.

https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/introduction/creating-a-connection-string

mathis1337
  • 1,426
  • 8
  • 13
0

I have an answer that I posted previously here:

Connection string

Please follow the steps to get your connection string, if successful share your experience and mark as answered else let us know where you are stuck that I will edit with more help.

B.S.
  • 668
  • 1
  • 5
  • 15