I could download and run the microsoft/mssql-server-windows-express
So this is works:
docker run -d -p 1433:1433 -e sa_password=MyPassword1 -e ACCEPT_EULA=Y microsoft/mssql-server-windows-express
I can connect it via the powershell and via the Sql server management studio (localhost, 1433 and SA and MyPass1) So I can see the databases and play with them.
However in .NET core API application I cannot connect to the dockerized mssql server express (windows dockerized and not linux)
"ConnectionStrings": {
"Default": "Server=127.0.0.1,1433;Database=master;User=sa;Password=MyPassword1 ;"
},
Unfortunately I get this sql exception always:
System.Data.SqlClient.SqlException: 'A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)'
So the mssql-server-windows-express container is running I can reach it by the powershell command and by the sql server management studio, but when I run the .net core api applicaion in the visual studio 2017 I get this sql exception always.
docker.for.win.localhost
as the host. – serpent5