skip to Main Content

I have created and am running SQL Server on Docker (on Mac). I am able to connect to it on Azure. I was able to run dotnet ef database update and the database appears in azure.

However, when I run my asp.net project and try to run a simple GET request to the database I get a pre-login handshake error. The GET request shouldn’t be the problem as I am following a tutorial and it’s basically the same.

I have specified the connection chain in appsettings.json:

"ConnectionStrings": {
    "CodeCamp": "Data Source=localhost, 1433;Initial Catalog=PSCodeCamp;User ID=sa;Password=Password-Is-L0ng"
  }

I used the same credentials to connect in Azure.

TL:DR: Handshake error in Rider/Postman, Working fine in Azure.

I also noticed that if I try to connect in azure while the app is running I get the same handshake error in Azure and I also tried to disconnect azure before running the app, still getting the same error.

The error in question:

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=40; handshake=14974; 

2

Answers


  1. Try below steps to solve this issue as there are multiple cases for the mentioned error message:

    1. Try to connect with IP Address instead of DNS.
    2. Check SQL Engine connectivity.
    3. Check the status of SQL Server service.
    4. Configure client and server under same protocal.
    5. Check firewall settings for ports.

    Check this blog to understand more about troubleshooting the error.

    Login or Signup to reply.
  2. Depending on the image, the Password part of your connection string should be replaced with SA_PASSWORD. There’s some information on the dockerhub but not too informative.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search