Sunday, April 8, 2018

Debugging mvc with RequireHttpsAttribute in Docker?

Trying to get the hang of Docker as I have some time to play around. The MVC site I'm playing with has the RequireHttpsAttribute applied. In visual studio, I added Docker support via the right-click>add>docker support (high level stuff, I know). The problem is, the docker support only seems to set it up on port 80/standard http. When I try to debug with RequireHttpsAttribute, it just fails with an Err_Connection_lost. Normally, I can debug an ssl site with no issues but adding docker, at least at the default settings, seems to break that. So far, my google-fu has only turned up one other person on stack overflow with the same issue and his question is thus far unanswered.

Here is my docker file:

FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 32773:443 FROM microsoft/aspnetcore-build:2.0 AS build WORKDIR /src COPY DockerTest.sln ./ COPY DockerTest.Web/DockerTest.Web.csproj DockerTest.Web/ RUN dotnet restore -nowarn:msb3202,nu1503 COPY . . WORKDIR /src/DockerTest.Web RUN dotnet build -c Release -o /app FROM build AS publish RUN dotnet publish -c Release -o /app FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "DockerTest.Web.dll"] 

And here is my docker-compose-override.yml:

version: '3' services: DockerTest.web: environment: - ASPNETCORE_ENVIRONMENT=Development - Port=32773:443 ports: - "32773:443" 

Any help would be appreciated at levels beyond my ability to accurately portray in text alone. It would take interpretive dance and quantum computers to get my thanks across.

Debugging mvc with RequireHttpsAttribute in Docker? Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team