我正在研究我的第一个ASP.Core MVC应用程序.在ASP.NET Core MVC应用程序中使用需要sql身份验证的sql server后端指定连接字符串的正确方法是什么?
ArgumentException:不支持关键字:'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" } } }
Jeremy Cook.. 45
userid
Server = myServerAddress; Database = myDataBase; User Id = myUsername; 密码= MYPASSWORD;
https://www.connectionstrings.com/sql-server/
userid
Server = myServerAddress; Database = myDataBase; User Id = myUsername; 密码= MYPASSWORD;
https://www.connectionstrings.com/sql-server/
那是因为正确的关键字是User Id
,如下例所示:
"ConnectionStrings": { "DefaultConnection": "Server=myServerAddress;Database=myDataBase;User Id=myUsername;password=myPassword;Trusted_Connection=False;MultipleActiveResultSets=true;" }