docker - 为什么 IIS 上的 docker 在源代码更改后会出现 http 403 错误?
问题描述
我可以成功构建并运行一个演示经典 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 - Forbidden : 访问被拒绝。您无权使用您提供的凭据查看此目录或页面。
我试图从许多来源(例如Docker 中的 IIS 返回 403 和IIS 上的 Dockerize ASP Classic)找到解决方案,但到目前为止没有成功。
谁能弄清楚为什么我在源代码中更改测试asp文件时总是遇到http 403?那么,应该怎么做才能解决这个问题呢?
解决方案
I think I found a solution on my own - although I really do not yet know why changing the source code of the demo project actually led to the 403 error. But however in examining the issue I created a new simple classic asp -project in another directory and adapted the Dockerfile to these path changes like so:
# 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
And after that I still received http-403 error. Then I found the following reply: 403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied and suddenly realized that because my asp-test file is not named as the default.asp -file the server is not finding it. So, my error was due to fairly naive and simple reason - at least in the second demo.
But asp-file in the first demo project was really of default type (default.asp) and therefore I do not for sure figure out why any changes in it will turn it to http-403 error. Maybe it has something to do with unzipping and zipping in between, and the server cannot find the rezipped folder with asp-file in it any more.
However, now at least the basic dockering of classic asp site works!
推荐阅读
- javascript - 我应该对这些使用 else-if 语句吗?
- scala - 将日期从一种格式解析为另一种格式
- python-2.7 - 在 div 类中获取MYTEXT之间的文本
- azure - Azure dns 将 www 转发到裸 no-www
- eclipse - STS 在一个干净的新 Maven 项目中显示错误
- android-studio - 从 Android Studio 3 到带有 Android 9 的三星的 APK 安装卡住了
- java - Java锁的条件实现
- python-3.x - 在 OpenCV Python 中屏蔽特定区域
- javascript - 随机出现哪个元素
- r - 在两个变量列表上循环迭代,以实现 R 中的多元回归