我正在vs 2022中处理我的mvc项目asp.net 6,我想将项目与数据库连接,所以我编写了以下命令
Scaffold-Dbcontext "Server=DESKTOP-kd; Database=Gestion; Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Data
当执行它时,显示给我这个错误消息:
Build started...
Build succeeded.
To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
Microsoft.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - La chaîne de certificats a été fournie par une autorité qui n’est pas approuvée.)
Error Number:-2146893019,State:0,Class:20
A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - La chaîne de certificats a été fournie par une autorité qui n’est pas approuvée.)
我尝试在appsettings的连接字符串中添加这些TrustServerCertificate=true; Encrypt=false;
,但没有任何变化。接下来我可以尝试什么?
我在vs 2022中处理我的mvc项目asp.net 6,我想将项目与数据库连接,所以我编写了以下命令
Scaffold-Dbcontext "Server=DESKTOP-LINA; Database=GestionSQLI; Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Data
我确定服务器和桌面的名称,我检查了很多次。
1条答案
按热度按时间rta7y2nd1#
“ConnectionStrings”:{“DefaultConnection”:“服务器=(localdb)\MSSQLLocalDB; String = String; return True; MultipleActiveResultSets=true”}
//或Scaffold-DbContext“Server=(localdb)\MSSQLLocalDB; String = String; return True;“Microsoft.EntityFrameworkCore.SqlServer -OutputDir模型