我正在开发我的第一个 ASP.NET Core MVC 应用程序。在具有需要 sql 身份验证的 sql server 后端的 ASP.NET Core MVC 应用程序中指定连接字符串的正确方法是什么?
ArgumentException: Keyword not supported: 'userid'.\
下面是我的 appsettings.json 文件。当我运行该应用程序时,它会抛出一个错误。
{
"ApplicationInsights": {
"InstrumentationKey": ""
},
"ConnectionStrings": {
"DefaultConnection": "Server=myserver;Database=mydatabase;userid=id;password=mypwd"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
最佳答案
user<space>id
Server=myServerAddress;Database=myDataBase;User Id=myUsername; Password=myPassword;
关于c# - 在 ASP.Core MVC 中使用用户名和密码设置连接字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41624783/