I’m pretty new to docker. I’m trying to run an MVC web app. in a container on Docker for Windows Desktop (Community version 18.104.22.168). This is on a Windows 10 system.
The steps I use to build the image are:
COPY ./ /inetpub/wwwroot/MC_v2
docker build -t mcv2 .
The run command is:
docker run --rm -d -p 8081:80 --name MCV2 mcv2
All pretty simple. The container starts, but when I go to the URL (http://localhost:8081/MC_v2/) I get the configuration error:
It is an error to use a section registered as allowDefinition=‘MachineToApplication’ beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
It gives web.config Line: 28 as the offending line:
<authentication mode="Windows" />
Normally I would configure the site for Anonymous Authentication and Allow all users in .Net authorization and in fact the site is working that way on my local machine. The error suggests to me that the location /MC_v2 is not configured as an application when it is running in the docker container.
But how do I do that? Is there a way in the dockerfile to do that? Or is there another issue here that I am missing?