繁体   English   中英

在 Docker 中运行 IIS 时无法访问站点

[英]Site can't be reached when running IIS in Docker

I followed the instructions on the official Dockerhub repo for IIS ( https://hub.docker.com/_/microsoft-windows-servercore-iis ), but running into "Site can't be reached" when trying to access via the容器的 IP。

当我尝试 htp://localhost:8000 时,我得到403 forbidden 我将test.html页面复制到C:/inetpub/wwwroot并通过登录容器进行验证。

appcmd list site的结果如下:

站点“默认 Web 站点”(id:1,bindings:http/*:80:,state:Started)

403通常表示我们试图访问的web地址不是网站的根目录。
我怀疑是否存在任何已复制到远程 docker 容器的文件。 请确保dockerfile所在目录包含内容文件夹并包含所有站点文件。

WORKDIR /inetpub/wwwroot

COPY content/ .

如果问题仍然存在,请随时告诉我。

你的分析是对的。 我没有意识到 IIS 可能服务 index.html 作为默认值,我的文件名为 helloworld.html 当我访问 localhost:8000 时显然不会服务当我尝试 localhost:8000/helloworld.html 时它可以工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM