connection string for sqlserver in Docker container

后端 未结 5 1675
無奈伤痛
無奈伤痛 2020-12-29 18:55

I\'m using Visual Studio 2017 for mac with dotnet Core and EF Core. After setting up the mssql image in Docker container , I was trying to add the connection string but thr

5条回答
  •  孤城傲影
    2020-12-29 19:31

    Rather than use IP addresses, which would be problematic in a team environment, you can also use host.docker.internal which will resolve to your host IP.

    Data Source=host.docker.internal,1433;Initial Catalog=MyDB;User ID=MyUser;Password=MyPassword
    

提交回复
热议问题