Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Im trying to run the scaffolding command in PMC.
Receving an error when running A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - Certifikatkedjan utfärdades av en icke betrodd certifikatutfärdare.)
(Swedish text says Certification is issued by a non thrusted publisher)

I have googled and it tells me to add the TrustServerCertificate=True and the Encrypt=False.

But i have had no luck. Is there something i need to do in the SQL server !?

The sceffold command now looks like this.
Scaffold-DbContext -Provider Microsoft.EntityFrameworkCore.SqlServer -Force -OutputDir Model -Connection "Data Source=MSIBeast\SQLEXPRESS";Initial Catalog=BBBank;Trusted_Connection=True;Encrypt=False;Integrated Security=True;TrustServerCertificate=True;

What I have tried:

I have tried the arguments suggested but it does not help.
Posted
Updated 29-Nov-23 23:11pm
v3

1 solution

Quote:
The sceffold command now looks like this.
PowerShell
Scaffold-DbContext -Provider Microsoft.EntityFrameworkCore.SqlServer -Force -OutputDir Model -Connection "Data Source=MSIBeast\SQLEXPRESS";Initial Catalog=BBBank;Trusted_Connection=True;Encrypt=False;Integrated Security=True;TrustServerCertificate=True;
The connection string ends at the double-quote after Data Source=MSIBeast\SQLEXPRESS; the rest of the line is not part of the connection string.

Move the double quote to the end of the connection string:
PowerShell
Scaffold-DbContext -Provider Microsoft.EntityFrameworkCore.SqlServer -Force -OutputDir Model -Connection "Data Source=MSIBeast\SQLEXPRESS;Initial Catalog=BBBank;Trusted_Connection=True;Encrypt=False;Integrated Security=True;TrustServerCertificate=True;"
 
Share this answer
 
Comments
SpiveyC# 30-Nov-23 5:17am    
hmmm... worked ,,, thanks. Should have catched that one :-D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900