Skip to content

MDS v2.0.0 | SSL Provider, error: 0 - The target principal name is incorrect #795

Closed

Description

@cheenamalhotra

Originally posted by @imranmomin in #43 (comment)

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;

Activity

  1. cheenamalhotra commented on Nov 12, 2020

    @cheenamalhotra
    MemberAuthor

    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!

  2. imranmomin commented on Nov 12, 2020

    @imranmomin

    @cheenamalhotra - Trust Server Certificate = true; solved it.

  3. cheenamalhotra commented on Nov 12, 2020

    @cheenamalhotra
    MemberAuthor

    Closing issue as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions