dotnet-architecture / eShopOnContainers

Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor. Moved to https://github.com/dotnet/eShop.
https://dot.net/architecture
24.52k stars 10.35k forks source link

Unable to connect from SQL Server Management Studio to docker container data #1729

Closed StefanG12345 closed 3 years ago

StefanG12345 commented 3 years ago

I am not sure if anyone reported the issue, but for some reason, after the latest pool of the app and the MSSQL MS latest update “18.9.2”, the SQL Server Management Studio is no longer able to connect to the docker container SQL database. The entire app is working great, the issue it is only with SQL Server Management Studio. The health check it is Ok, the container “src_sqldata_1” is correctly loaded on port “5433” and everything looks good. However, when you try to connect with MS to docker container - localhost,5433 – you get this error:

TITLE: Connect to Server

Cannot connect to localhost,5433.


ADDITIONAL INFORMATION:

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (Provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.) (Microsoft SQL Server, Error: 10054)

For help, click: https://docs.microsoft.com/sql/relational-databases/errors-events/mssqlserver-10054-database-engine-error

I have followed a few steps, the once indicated in here plus the once indicated in here: https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/apps-forcibly-closed-tls-connection-errors#workaround

Once the app is fully up, from a separate terminal, you can connect to SQL Server data in docker, so the SQL Server it is fine and ready to accept requests.

docker exec -it src_sqldata_1 /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Pass@word" -Q "SELECT @@VERSION"

It is just the SQL Server Management Studio is just simply refusing to connect. I was just wondering if anyone have experienced similar issues, any help will be greatly appreciated.

FYI, an earlier version of the app used to work fine.

Thanks Stefan G.

sughosneo commented 3 years ago

Hi @StefanG12345, thank you for reaching out and sharing all the details.

I just ran a quick test in my local, and I am able to connect to the SQL docker container from the Management Studio.

image

Please note that the eshop app uses mcr.microsoft.com/mssql/server:2019-latest docker image to run the SQL instance, and I used the SSMS version 17.9.1.

Looking at the error message, I can think of performing/validating the following scenarios :

If the issue still persists, then you can raise an issue in this microsoft/mssql-docker with respective details.

sughosneo commented 3 years ago

Hi @StefanG12345 , just checking if you had a chance to test this solution out further. Thank you.

sughosneo commented 3 years ago

I am closing this issue as of now. Please feel free to reopen if it's needed. Thank you.