I'm using the microsoft/aspnet:4.7.1
to host ASP.NET MVC inside a docker container, but I also need SSL, so I've added the binding as the container starts
The container starts fine, but on looking at the IIS Website, it's marked as Stopped
.
I can't see anything in the event logs, to help out, trying to Start-Website -name "Site"
just gives the below error. I tried removing the default website, and putting mine in it's place, but that also errors.
I have a Remove-Website
in there, but this is still not removed.
Start-Website : Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)
At line:1 char:1
+ Start-Website -Name "Site"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Website], COMException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.IIs.PowerShell.Provider.StartWebsiteCommand
Running Websites
PS C:\inetpubwwwroot> Get-ChildItem -Path IIS:\Sites
Name ID State Physical Path Bindings
---- -- ----- ------------- --------
Site 8374 Stopped C:\inetpub\wwwroot http *:8080:
4692 http *:443:
9
DOCKERFILE
FROM microsoft/aspnet:4.7.1-windowsservercore-1709
RUN powershell -NoProfile -Command \
Import-module IISAdministration; \
Remove-Website -Name *;
RUN powershell -NoProfile -Command New-IISSite -Name "Site" -PhysicalPath C:\inetpub\wwwroot -BindingInformation "*:8080:"; \
New-WebBinding -Name "Site" -IPAddress "*" -Port 443
WORKDIR /inetpub\wwwroot
COPY ./bin/Debug/PublishOutput .
User contributions licensed under CC BY-SA 3.0