add

Thursday, September 14, 2023

A connection was successfully established with the server, but then an error occurred during the login process.

 If you are creating the database using code first db approach using Entityframework Core and while creating the database using 'Update Database' command encounter the below error:


A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)

Chances are there that there is an issue with the connection string mentioned in the web.config or appsettings.json (if using asp.net core app).

Compare the below before and after connection string :

OLD:

data source=YOUR_SERVER_NAME;initial catalog=YOUR_DB_NAME;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework


NEW:

data source=YOUR_SERVER_NAME;initial catalog=YOUR_DB_NAME;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework;Trusted_Connection=SSPI;Encrypt=false;


Add the above highlighted part at the end of the connection string and try to build the database.

It should work.

Cheers :) 

No comments: