I'm having an issue with my project. All started with docker, when I try to run it with IIS Express, it works normally, but when I use Docker the database just doesn't connect and return data. I tested it with a local SQL Server 2019 database and it is connecting normal, I don't know if the issues is with docker or maybe the version with the SQL Server.
I'm using SQL Server 2008 SP3.
Connection string in both cases (when it works, IIS, and when it doesn't, docker)
"SQLConnection": "Data Source=server;Initial Catalog=mydatabsae;User ID=user;Password=mypassword;MultipleActiveResultSets=True"
DockerFile
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-bionic AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic AS build
WORKDIR /src
COPY ["Buscador.csproj", ""]
RUN dotnet restore "./Buscador.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "Buscador.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Buscador.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Buscador.dll"]
Edit: I'm getting this error:
SqlException: Connection Timeout Expired.
The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=18; handshake=124; [Login] initialization=2; authentication=9; [Post-Login] complete=14466;