[英]SQL Connection String appsettings.json
This is my connection string这是我的连接字符串
{
"Data": {
"PhotoGalleryConnection": {
"ConnectionString": "Server=WINDOWS-B7MJR5T\\SQLEXPRESS;User Id=sa;password=allah;Database=PhotoGallery;Trusted_Connection=True;MultipleActiveResultSets=true"
}
}
}
And I am facing this exception我正面临这个例外
An exception of type 'System.Data.SqlClient.SqlException' occurred in Microsoft.EntityFrameworkCore.dll but was not handled in user code Additional information: Cannot open database "PhotoGallery" requested by the login.
Microsoft.EntityFrameworkCore.dll 中发生类型为“System.Data.SqlClient.SqlException”的异常,但未在用户代码中处理附加信息:无法打开登录请求的数据库“PhotoGallery”。 The login failed.
登录失败。
It should work after You delete Trusted_Connection=True; 删除Trusted_Connection = True后,它应该可以工作; from connection string.
从连接字符串。
If you specify either Trusted_Connection=True;
如果您指定Trusted_Connection = True; or Integrated Security=SSPI;
或Integrated Security = SSPI; or Integrated Security=true;
或Integrated Security = true; in your connection string THEN (and only then) you have Windows Authentication happening.
在您的连接字符串中(然后(仅那时))中,您正在进行Windows身份验证。 Any user id= setting in the connection string will be ignored.
连接字符串中的任何用户id =设置都将被忽略。 Found in here: When using Trusted_Connection=true and SQL Server authentication, will this effect performance?
在此处找到: 使用Trusted_Connection = true和SQL Server身份验证时,这会影响性能吗?
Please search services in the window menu, it will show you the local services then go to SQL server services and refresh all, then go to the SQL server management studio and by using SQL authentication please provide username and password, you will be able to use the SQL server.请在window菜单中搜索服务,它将显示本地服务然后go到SQL服务器服务并刷新所有,然后go到SQL服务器管理工作室并通过使用SQL,身份验证将能够使用您提供用户名和密码SQL 服务器。 for appsetting.json update, trusted_connection is used for window authentication not for SQL server authentication by using username and password
对于 appsetting.json 更新,trusted_connection 用于 window 身份验证,而不是使用用户名和密码进行 SQL 服务器身份验证
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.