Hi Sherpa,
You're hitting this because of a breaking change in EF Core 7.0 (which .NET 8 uses). The Encrypt parameter now defaults to true instead of false.
Quick fix:
Add Encrypt=false to your connection string in appSettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=your-server;Database=your-db;Trusted_Connection=true;Encrypt=false"
}
}
Better fix (if you want to keep encryption):
{
"ConnectionStrings": {
"DefaultConnection": "Server=your-server;Database=your-db;Trusted_Connection=true;Encrypt=true;TrustServerCertificate=true"
}
}
The second option keeps encryption enabled but ignores certificate issues, which is good for development.
Why this happened:
Microsoft made encryption the default for better security. Your .NET 6 app worked because Encrypt defaulted to false, but .NET 8 defaults it to true.
Just add Encrypt=false to your connection string and you'll be back up and running.
Hope this help!