'New project created in Visual Studio 2019 with Docker support - cannot connect to the app
I have minimal experience with Docker so if I'm missing something please guide me :)
I've just created a new ASP.Net core app and I checked "Enable Docker support" (I need it, I thought I'd add it later, but I had chosen to add it since the beginning so it would be easier)
The project is now created.
I run the container, press on each of those host ports
and it doesn't connect.
I expected it to work out of the box (without me doing any settings). Am I wrong to expect that?
Is there any settings that I need to have in order to work?
Thanks.
//Edit: if I click on those buttons, it opens up a browser tab with localhost:49158 respectively localhost:49157
My Dockerfile:
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["best-mediere.csproj", "."]
RUN dotnet restore "./best-mediere.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "best-mediere.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "best-mediere.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "best-mediere.dll"]
Command that VS uses when I press CTRL+F5
docker exec -i -e ASPNETCORE_HTTPS_PORT="49159" -w "/app" bceedb5aab26c8f206363e58dff9ffaba7b2bb8b70a02255482be4a7522ccbd7 sh -c ""dotnet" --additionalProbingPath /root/.nuget/fallbackpackages4 --additionalProbingPath /root/.nuget/fallbackpackages --additionalProbingPath /root/.nu
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

