我是mac的新手,使用docker映像运行。这是我运行图像的命令。
docker run -d --name SQLServerImg -e ACCEPT_EULA=Y -e SA_PASSWORD=StrongPassword@123 -p 1433:1433 mcr.microsoft.com/azure-sql-edge这是我的appsettings.json中的连接字符串
"ConnectionStrings": {
"EmployeesManagementDB" : "Server=127.0.0.1,1433;Database=EmployeesManagementDB;MultipleActiveResultSets=true;User Id=sa;Password=StrongPassword@123"
}这是我的Progoram.cs
builder.Services.AddControllers();
var connectionString = builder.Configuration.GetConnectionString("EmployeesManagementDB");
builder.Services.AddDbContext<EmployeeContext>(options => options.UseSqlServer(connectionString));当我运行dotnet数据库更新时,我一直收到以下错误。
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)我怎样才能解决这个问题?我有遗漏什么吗?
谢谢。
发布于 2022-04-25 20:17:55
在连接字符串中,参数“用户Id”似乎是错误的,而是尝试将其替换为"User“。另外,尝试从连接字符串中删除"MultipleActiveResultSets=true“。
尝试:
"ConnectionStrings": {
"EmployeesManagementDB" : "Server=127.0.0.1,1433;Database=EmployeesManagementDB;User=sa;Password=StrongPassword@123"}https://stackoverflow.com/questions/71838139
复制相似问题