IIS in Docker returning 403

随声附和 提交于 2021-01-28 05:42:33

问题


I have a Docker image with the ASP.NET dependencies added and a website with a single index.html.

The DockerFile is:

# escape=`
FROM iis-with-asp
ADD ./Ping C:/Ping
RUN ["C:\\Windows\\System32\\icacls.exe", "\"C:\\Ping\"", "/grant", "\"IIS AppPool\\DefaultAppPool\":(OI)(CI)", "/T"]
RUN ["C:\\Windows\\System32\\icacls.exe", "\"C:\\Ping\"", "/grant", "\"IIS_IUSRS\":(OI)(CI)", "/T"]
RUN ["C:\\Windows\\System32\\icacls.exe", "\"C:\\Ping\"", "/grant", "\"Network Service\":(OI)(CI)", "/T"]
RUN ["\\Windows\\system32\\inetsrv\\AppCmd.exe", "add",  "sites",  "/name:\"Ping\"", "/id:2", "/bindings:http://localhost:9000", "/physicalPath:C:\\Ping"]
EXPOSE 9000
RUN ["\\Windows\\system32\\inetsrv\\AppCmd.exe", "list", "site"]

It's build with:

docker build -t u .

and running it with:

docker run -p 9000:9000 u

When I hit http://localhost:9000 with Fiddler I get a 409 though.


回答1:


your exposing 9000 port to host machine, you should access with 9000 port only but make sure that you're exporting correct application port. ex: (host machine)9000:5000(app port)



来源:https://stackoverflow.com/questions/50588661/iis-in-docker-returning-403

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!