❔ Entity Framework + Docker sql server on ubuntu

the error A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught) the code
using Microsoft.EntityFrameworkCore;
using cPizza.Models;

namespace cPizza.Data
{
public class ApplicationDbContext : DbContext
{
public DbSet<PizzaOrder> PizzaOrders { get; set; }

public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
{

}
}
}
using Microsoft.EntityFrameworkCore;
using cPizza.Models;

namespace cPizza.Data
{
public class ApplicationDbContext : DbContext
{
public DbSet<PizzaOrder> PizzaOrders { get; set; }

public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
{

}
}
}
{
"ConnectionStrings": {
"DefaultConnection": "Server=172.17.0.2,1433;Database=PizzaDB;User Id=SA;Password=TheB@s3dPass"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
{
"ConnectionStrings": {
"DefaultConnection": "Server=172.17.0.2,1433;Database=PizzaDB;User Id=SA;Password=TheB@s3dPass"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
(docker ps) dc9a3c76a8f8 mcr.microsoft.com/mssql/server:2019-latest "/opt/mssql/bin/perm…" 18 minutes ago Up 8 minutes 0.0.0.0:1433->1433/tcp, :::1433->1433/tcp sql1 s (docker ip) "IPAddress": "172.17.0.2",
"PortBindings": {
"1433/tcp": [
{
"HostIp": "",
"HostPort": "1433"
}
]
},
"PortBindings": {
"1433/tcp": [
{
"HostIp": "",
"HostPort": "1433"
}
]
},
19 Replies
JakenVeina
JakenVeina2y ago
where are you getting that error?
TheBasedTaka
TheBasedTakaOP2y ago
when i try to dotnet ef database update
JakenVeina
JakenVeina2y ago
well, that's got nothing to do with NET what's the network config look like on the database container? sounds like maybe something's getting firewalled?
TheBasedTaka
TheBasedTakaOP2y ago
the documentation was saying that its the same as the host fllushing my iptables leads to the same result
JakenVeina
JakenVeina2y ago
what's the same as what host?
TheBasedTaka
TheBasedTakaOP2y ago
the firewall
JakenVeina
JakenVeina2y ago
what documentation?
TheBasedTaka
TheBasedTakaOP2y ago
I found it when I was playing with iptables but you probably know better than I
JakenVeina
JakenVeina2y ago
not really I know basically nothing about your environment what I know is only what you've toldd me you're getting an error when running the command to apply migrations to a database, within the EF Core designer toolkit the error, you say, is
A connection was successfully established with the server, but then an error occurred during the pre-login handshake
this, to me, sounds an awful lot like a firewall issue, of some kind the connection was established, so all your connection details should be good like, the IP address of the database server is good as is the port something is ACCEPTING your connection presumably, that's the database and whatever "handshake" happens to setup for login is what's failing maybe there's a firewall that's killing the traffic for some reason maybe it's the database itself that's rejecting it, because of some config mismatch would be nice to see that "internal exception" that was caught maybe you can enable debug logging for the tools and see what that is, if there exists such an option
TheBasedTaka
TheBasedTakaOP2y ago
never see anything in the logs
TheBasedTaka
TheBasedTakaOP2y ago
and its weird because i can't even find out what firewall the container uses, iptables/firewalld and all that stuff doesn't work huigt4whiugh4qio ghiweorahgiowaerhig
TheBasedTaka
TheBasedTakaOP2y ago
TheBasedTaka
TheBasedTakaOP2y ago
\
TheBasedTaka
TheBasedTakaOP2y ago
well found it @ReactiveVeina
JakenVeina
JakenVeina2y ago
aha that explains it yeah, your server is probably using a private cert managed by your organization? one whose root is not pre-installed on your dev machine as trusted?
TheBasedTaka
TheBasedTakaOP2y ago
this is just my linux vm guess it doesn't trust HmmHmmCouncilRTX2HmmCouncilRTX1HmmCouncilRTX3HmmCouncilRTX5HmmCouncilRTX4
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
JakenVeina
JakenVeina2y ago
what's a VM? The database server, or your dev client?
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server