【发布时间】:2021-11-09 02:21:42
【问题描述】:
我正在 MacBook 上部署一个带有 VS2017 的 ASP.NET Core MVC 应用程序。当我想更新我的数据库时
dotnet ef database update --project MyProjectName
我收到一个错误:
不支持连接字符串关键字“服务器”。有关可能的替代方案,请参阅https://go.microsoft.com/fwlink/?linkid=2142181。
我已经在我的项目中安装了System.Data.SqlClient 包,并且我已经阅读了类似的问题,但没有一个能解决我的问题。这段代码有什么问题?我真的很困惑。
"ConnectionStrings": {
"DefaultConnection": "Server=my_ip; Database=my_db; User Id=sa; Password=my_pass;",
"providerName": "System.Data.SqlClient"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
【问题讨论】:
-
嗨,有趣,也许用 Uri 代替?
-
嗨@jspcal。感谢您的评论。我尝试了所有方法,甚至我使用过
Data Source和Initial Catalog,但没有任何改变
标签: c# sql-server asp.net-core .net-core connection-string