Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnet ef update database : A connection was successfully established with the server, but then an error occurred during the login process

When I run dotnet ef update database I get this 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.)

my csproj file:

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-preview.5.22302.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0-preview.5.22302.2">
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.5.22302.2" />
  </ItemGroup>

my connection string:

"DefaultConnectionString": "Server=.;Database=ShopCore;Trusted_Connection=True;"
like image 662
Amirabbas Motamedi Avatar asked Sep 01 '25 09:09

Amirabbas Motamedi


2 Answers

"Data Source=DESKTOP-R34I8VP;Initial Catalog=LINQ;Integrated Security=True;TrustServerCertificate=True"

Or

"Server=DESKTOP-R34I8VP;Database=Linq;Trusted_Connection=True;TrustServerCertificate=True;"
like image 113
Ragab Mohamad Avatar answered Sep 04 '25 21:09

Ragab Mohamad


Add encrypt=false; to your connection string. If you're using Azure SQL though, I think an encrypted connection is required.

like image 45
Bill Sambrone Avatar answered Sep 04 '25 19:09

Bill Sambrone



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!