I'm creating a container, which has an .net core application, based on the official microsoft image.
I'm getting the following error when the application try to connect to SQL server, it only happens inside the container: A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 31 - Encryption(ssl/tls) handshake failed)
My application uses the following packages for communcicate with sqlserver:
- System.Data.SqlClient 4.8.2
- Dapper 2.0.78
My connectionstring looks like this:
Data Source=xxx.xxx.xxx.xxx;Initial Catalog=XXXXXXXX;User ID=XXXXX;Password=XXXX;MultipleActiveResultSets=True;Connect Timeout=60;TrustServerCertificate=true
My docker Version isthe latest avaliable at the time: "Docker version 20.10.2, build 2291f61" is running on windows and this is how i'm creating the docher image:
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build-env
WORKDIR /prj
COPY . .
RUN dotnet publish myapp.csproj -o /app
FROM mcr.microsoft.com/dotnet/aspnet:3.1
WORKDIR /app
RUN update-ca-certificates --fresh
COPY --from=build-env /app .
ENTRYPOINT ["dotnet", "myapp.dll"]
I've been googling for some time now, and I didn't found a solution that works for me, can some one help?