You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MDS v2.0.0 | SSL Provider, error: 0 - The target principal name is incorrect #795
Yesterday - when .NET 5 was released I upgraded my application. I'm facing a similar issue A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The target principal name is incorrect.).
When I downgrade to EF Core 3.10.0 it works fine. It only fails when using EF Core 5. After some investigation I found out that EF Core 3.1.10 uses Microsoft.Data.SqlClient 1.1.3.
And when I upgrade Microsoft.Data.SqlClient to 2.0.0 it start failing with error A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: HTTP Provider, error: 0 - )
And on v 2.0.1 the error is A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The target principal name is incorrect.)
Note: It works fine when connecting to local SQL Server 15.0.2000.5 and fails when it tries to connect a remote SQL Server 12.0.6024.0
Connection string used - data source=xxx;initial catalog=xxx_db;user id=xxx;password=xxx;
This issue looks related to changes in 2.0 where certificate validation is now performed when connecting to a SQL Server that "Enforces" encryption. View > Breaking changes in v2.0.
Please follow steps from here (#609 (comment)) , and let us know!
Activity
cheenamalhotra commentedon Nov 12, 2020
Hi @imranmomin
I've opened this new issue to track better.
This issue looks related to changes in 2.0 where certificate validation is now performed when connecting to a SQL Server that "Enforces" encryption. View > Breaking changes in v2.0.
Please follow steps from here (#609 (comment)) , and let us know!
imranmomin commentedon Nov 12, 2020
@cheenamalhotra -
Trust Server Certificate = true;solved it.cheenamalhotra commentedon Nov 12, 2020
Closing issue as resolved.