Copying aspnet app content to wwwroot inside container (IIS,windows) works fine, mapping the same directory content to wwwroot returns 401

  asp.net-mvc, docker, docker-compose, iis, windows

When copying the application content into the container, it works. But if rather than copying, the folder is mapped to the folder in the host, I get 401 from IIS.

So, this works

# Dockerfile
FROM microsoft/aspnet

COPY ./src/publish/ /inetpub/wwwroot

# ---------------------------------

# docker-compose.yaml
version: '3.8'
services:
  webapp:
    build: .
    ports:
      - "8080:80"

Browse to localhost:8080, OK.

Now, the following fails:

# Dockerfile
FROM microsoft/aspnet

# ----------------------------

# docker-compose.yaml
version: '3.8'
services:
  webapp:
    build: .
    ports:
      - "8080:80"   
    volumes:
      - ./src/publish/:C:/inetpub/wwwroot

Browse to localhost:8080, I get 401.

I inspect the content of wwwroot in the container, and I see the same content in both cases, as expected.
The IIS logs (inetpub/logs) only shows 401, no further info.

What am I missing?

Source: Windows Questions

LEAVE A COMMENT