我可以成功构建并运行一个演示经典ASP网站
(在此处给出:https://www.docker.com/blog/get-apps-off-windows-2003-cloud-docker-enterprise/)
(源代码在这里:https://github.com/sixeyed/presentations/tree/master/docker-webinars/from-w2k3-to-cloud)和以下Dockerfile:
# 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
生成镜像(docker image build -t sixeyed / w2k3-classic-asp -f。\ docker \ classic-asp \ Dockerfile。)并运行容器后(docker container run -d sixeyed / w2k3-classic-asp)然后浏览到特别的URL(由docker container inspect查找),确实可以按预期获得经典的ASP站点工作。
但是,每当我解压缩并更改(甚至一点点)演示asp文件中的源代码(在共享文件夹中),然后重建图像并再次运行容器并浏览到url时,我总是会遇到http 403-禁止访问:访问被拒绝。您无权使用您提供的凭据查看此目录或页面。
我试图从许多来源(例如IIS in Docker returning 403和Dockerize ASP Classic on IIS)中找到解决方案,但到目前为止没有成功。
谁能弄清楚为什么我在源代码中更改测试asp文件时总是遇到http 403?那么,应该怎么做才能解决此问题?
最佳答案
我想我自己找到了一个解决方案-尽管我真的还不知道为什么更改演示项目的源代码实际上会导致403错误。但是,在检查问题时,我在另一个目录中创建了一个新的简单经典asp -project并将Dockerfile修改为以下路径更改:
# escape=`
FROM microsoft/iis:windowsservercore-ltsc2016
SHELL ["powershell", "-Command"]
RUN Install-WindowsFeature Web-ASP
RUN mkdir C:\testAsp
COPY ./code/asp/ C:\testAsp
RUN Remove-Website -Name 'Default Web Site'; `
New-Website -Name web-app -Port 8000 -PhysicalPath C:\testAsp
之后,我仍然收到http-403错误。然后我发现以下答复:403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied,突然意识到,由于我的asp-test文件未命名为default.asp -file,因此服务器未找到它。所以,我的错误是由于天真的和简单的原因-至少在第二个演示中。
但是第一个演示项目中的asp文件实际上是默认类型(default.asp),因此我不确定为什么其中的任何更改都会导致它变成http-403错误。也许与两者之间的解压缩和压缩有关,并且服务器无法再找到其中包含asp文件的重新压缩文件夹。
但是,现在至少可以使用经典asp站点的基本dockering功能!
关于docker - 为什么在源代码更改后,IIS上的docker会给出http 403错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60421611/