Dockerize ASP Classic on IIS
Ask Question Asked 4 years, 1 month ago Active 9 months ago Viewed 9k times 22Microsoft has been investing in running docker on windows with Docker Desktop for Windows. Is it possible to run a legacy ASP Classic application on IIS through Docker? How?
https://hub.docker.com/r/microsoft/iis/
dockerasp-classiciis-7docker-for-windowsdocker-desktop share edit flag edited Feb 12 '19 at 17:01 veben 5,64499 gold badges3737 silver badges5050 bronze badges asked Oct 18 '16 at 4:07 Patrick Lee Scott 6,55011 gold badge2929 silver badges4242 bronze badges add a comment3 Answers
ActiveOldestVotes 3I haven't tried, but it shouldn't be an issue to run classic ASP. The microsoft/iis
image is based from the microsoft/windowsservercore
image, which is a full Server Core install, and also includes 32-bit support.
The ASP feature won't be there by default, so your Dockerfile would have to start like this:
# escape=`
FROM microsoft/iis
SHELL ["powershell", "-command"]
RUN Install-WindowsFeature Web-ASP
(The escape
and SHELL
lines just make it easier to build Windows-friendy Dockerfiles, see Windows, Dockerfiles and the Backtick Backslash Backlash).
Then you would COPY
in your ASP app folder, and run the rest of your IIS setup with PowerShell commands. This question has some good pointers, and this Dockerfile for an ASP.NET app shows how you can use PowerShell to configure websites.
- Awesome would love to try but hitting a new issue - windowsservercore image on docker hub seems to be corrupt - tried on two machine and two networks but it doesn't download successfully :( – Patrick Lee Scott Oct 18 '16 at 15:13
- ` ➜ docker pull microsoft/windowsservercore Using default tag: latest latest: Pulling from microsoft/windowsservercore 9c7f9c7d9bc2: Retrying in 9 seconds de5064718b3f: Retrying in 10 seconds ` and eventually "unknown blob" – Patrick Lee Scott Oct 18 '16 at 15:15
- Guess it's because you can only run windows containers on windows :( – Patrick Lee Scott Oct 18 '16 at 15:26
- If you're using Windows Server 2016 make sure you run Windows Update - on Windows 10, you'll want to be on the Insider track. With the latest versions I have no issues with the Hub. – Elton Stoneman Oct 18 '16 at 15:37
I finally got this all working. It was a lot more complex than running a simple Dockerfile, as it was a site that was originally developed in 2002. There were modules that had to be downloaded and installed, web.config sections that needed to be unlocked, and ODBC data connections that had to be made. My final docker file looked like this - hope it helps the next person!
# escape=`
FROM microsoft/iis
SHELL ["powershell", "-command"]
RUN Install-WindowsFeature Web-ASP; `
Install-WindowsFeature Web-CGI; `
Install-WindowsFeature Web-ISAPI-Ext; `
Install-WindowsFeature Web-ISAPI-Filter; `
Install-WindowsFeature Web-Includes; `
Install-WindowsFeature Web-HTTP-Errors; `
Install-WindowsFeature Web-Common-HTTP; `
Install-WindowsFeature Web-Performance; `
Install-WindowsFeature WAS; `
Import-module IISAdministration;
RUN md c:/msi;
RUN Invoke-WebRequest 'http://download.microsoft.com/download/C/9/E/C9E8180D-4E51-40A6-A9BF-776990D8BCA9/rewrite_amd64.msi' -OutFile c:/msi/urlrewrite2.msi; `
Start-Process 'c:/msi/urlrewrite2.msi' '/qn' -PassThru | Wait-Process;
RUN Invoke-WebRequest 'https://download.microsoft.com/download/1/E/7/1E7B1181-3974-4B29-9A47-CC857B271AA2/English/X64/msodbcsql.msi' -OutFile c:/msi/msodbcsql.msi;
RUN ["cmd", "/S", "/C", "c:\\windows\\syswow64\\msiexec", "/i", "c:\\msi\\msodbcsql.msi", "IACCEPTMSODBCSQLLICENSETERMS=YES", "ADDLOCAL=ALL", "/qn"];
EXPOSE 8000
RUN Remove-Website -Name 'Default Web Site'; `
md c:\mywebsite; `
New-IISSite -Name "mywebsite" `
-PhysicalPath 'c:\mywebsite' `
-BindingInformation "*:8000:";
RUN & c:\windows\system32\inetsrv\appcmd.exe `
unlock config `
/section:system.webServer/asp
RUN & c:\windows\system32\inetsrv\appcmd.exe `
unlock config `
/section:system.webServer/handlers
RUN & c:\windows\system32\inetsrv\appcmd.exe `
unlock config `
/section:system.webServer/modules
RUN Add-OdbcDsn -Name "mywebsite" `
-DriverName "\"ODBC Driver 13 For SQL Server\"" `
-DsnType "System" `
-SetPropertyValue @("\"Server=XXXX.us-east-2.rds.amazonaws.com\"", "\"Trusted_Connection=No\"");
ADD . c:\mywebsite
share edit flag
answered Nov 1 '16 at 18:36
Patrick Lee Scott
6,55011 gold badge2929 silver badges4242 bronze badges
- Elton Stoneman's answer was really important for setting me off in the right direction, so make sure you check that out below, too, for a better understanding. – Patrick Lee Scott Oct 8 at 20:01
Deploying classic ASP application on IIS through Docker
Ask Question Asked 1 year, 3 months ago Active 1 year, 3 months ago Viewed 999 times 1I want to deploy my legacy classic asp application on IIS through docker.I am able to create image and i am able to run the image. Everything works well,but when i tried hit the IP Address ,it is not working.
I followed below steps. 1.I used below Docker file and my application placed in share folder. 2.I ran the docker file using following power shell command:
Docker file:
#escape=`
FROM microsoft/iis:windowsservercore-ltsc2016
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Install-WindowsFeature Web-ASP
COPY ./share/ClassicAspApp.zip
RUN Expand-Archive -Path ClassicAspApp.zip -DestinationPath C:\ClassicAspApp; `
Remove-Item ClassicAspApp.zip
RUN Remove-Website -Name 'Default Web Site'; `
New-Website -Name web-app -Port 80 -PhysicalPath C:\ClassicAspApp
Shell Command :
docker image build `
-t sixeyed/w2k3-classic-asp `
-f .\docker\classic-asp\Dockerfile . #1.1
docker container run -d sixeyed/w2k3-classic-asp
At last i ran the docker container inspect given Container id .then it shows the all the details about the container,in that i found ip address,when i hit the ip address in the browser. Its not displaying my site.
c#asp.net.netdockerasp-classic share edit flag edited Aug 13 '19 at 14:50 A_Arnold 1,9611717 silver badges3636 bronze badges asked Aug 13 '19 at 13:39 pradeep kumar 1111 bronze badge-
Have you checked container logs?
docker logs -f {container id}
– Mohsin Mehmood Aug 13 '19 at 18:54 - Checked the logs but there is no logs captured. The file size is 0kb. is it related to any proxy settings ? – pradeep kumar Aug 14 '19 at 5:02
- C# , .net and asp.net have nothing to do with classic asp. Have you left some info out or put too much info in? – Jon P Aug 14 '19 at 7:16
1 Answer
ActiveOldestVotes 0I believe you are missing port mapping while run the container: Try like this
docker run -d -p 8081:80 sixeyed/w2k3-classic-asp
And then try accessing your website at http://localhost:8081
Note 8081 is any random port you can even map port 80 on your machine to port 80 of the container
share edit flag answered Aug 14 '19 at 6:22 Mohsin Mehmood 3,51222 gold badges1010 silver badges1616 bronze badges- Great thank you so much,it works for me.Could you tell me how to test database connection.I have one page which connects to SQL and display the details.how to install drivers in container to talk to database. i have sql server database but container doesnt have sql server native client 11.please help me out – pradeep kumar Aug 21 '19 at 10:26
标签:Web,ASP,RUN,IIS,WindowsFeature,Dockerize,Install,docker From: https://www.cnblogs.com/ioriwellings/p/14108843.html