microsoft / iis-docker

Dockerfile for IIS
https://hub.docker.com/r/microsoft/iis/
MIT License
288 stars 128 forks source link

Default App Pool crashes when enabling 32 bit support #194

Closed ecclejau closed 1 year ago

ecclejau commented 2 years ago

Ultimately I want to package an existing WCF application as a docker image. I noticed that setting the enable32BitAppOnWin64 to true causes the service to return HTTP 503.

The system event log on the container contains five entries from the WAS source with the following message:

A process serving application pool 'DefaultAppPool' terminated unexpectedly. The process id was '4484'. The process exit code was '0xc0000139'.

Followed by an entry:

Application pool 'DefaultAppPool' is being automatically disabled due to a series of failures in the process(es) serving that application pool.

When the container is first started, attaching to the container (docker container exec -it test-iis powershell) and listing the app pools (Get-IISAppPool) shows that the default pool is started. After the first request to the service (simple HTTP GET /) HTTP 503 is returned, and listing the app pools shows that the default pool is stopped.

I've tried to distil this down to the simplest example that reproduces the observed behaviour. The following packages a static site, setting the enable32BitAppOnWin64 flag.

Dockerfile

FROM mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019

SHELL ["powershell"]

RUN Remove-Item -Recurse C:\inetpub\wwwroot\*

# This line seems to cause the issue
RUN Import-Module WebAdministration; Set-ItemProperty -Path 'IIS:\AppPools\DefaultAppPool' -Name 'enable32BitAppOnWin64' -Value 'True'; 

WORKDIR /inetpub/wwwroot
COPY ./index.html .

Index.html

<html>
    <head>
        <title>Test</title>
    </head>

    <body>
        <h1>Test!</h1>
    </body>
</html>

Build command:

docker build --pull --rm -f "Dockerfile" -t iisdocker:latest .

Run command:

docker run --rm --name test-iis -p 8080:80 -it iisdocker

Access the service via http://localhost:8080/

Could someone advise?

ecclejau commented 2 years ago

On further investigation it looks like the last tag that works when enable32BitAppOnWin64 is set to True is 20200114-windowsservercore-ltsc2019