我正在使用带有dotnet Core和EF Core的Visual Studio 2017 Mac版。在设置了Docker容器中的mssql映像后,我尝试添加连接字符串,但出现了连接错误。我尝试使用不同的选项,例如IP地址、容器名称、主机名等作为服务器名称,但它们都没有起作用。
"Default": "Server=172.17.0.2; Database=ERPDb; User=sa; Password =******;"
带有容器名称
"Default": "Server=ecstatic_hermann; Database=ERPDb; User=sa; Password=******;"
使用主机名:
"Default": "Server=f45840a59623; Database=ERPDb; User=sa; Password=******;"
在终端中使用localhost连接时,连接成功
$ mssql -s localhost -p Technocrat123
Connecting to localhost...done
sql-cli version 0.6.2
Enter ".help" for usage hints.
但是当运行应用程序时,连接失败。
感谢任何帮助。提前致谢。
如果使用本地主机,则错误为
Login failed for user ''. Reason: An attempt to login using SQL authentication failed. Server is configured for Integrated authentication only.
Data Source=localhost;Initial Catalog=<database>;User ID=sa;Password=<password>
。 - Bruno SerranoData Source
代替Server
和Initial Catalog
代替Database
吗?当我更改这些名称时,它开始工作了。 - Bruno Serrano