You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker容器中Windows服务Web前端访问出现403错误求助

Docker容器中Windows服务Web前端访问出现403禁止错误

我是Docker新手,正在尝试将公司的一个解决方案容器化。这是一个用于构建分发给客户端数据包的Windows服务,附带一个小型Web前端用于交互和触发包构建。构建镜像并运行容器后,Visual Studio解决方案的所有二进制文件已复制到容器的C:/inetpub/wwwroot目录下,且已将主机的1337端口映射到容器的80端口。

然而,当我尝试访问localhost:1337以获取容器中运行服务的Web前端时,出现了403错误,错误页面如下:

403错误页面

以下是我的Dockerfile,麻烦各位帮忙排查可能的原因,提前感谢!

# escape=\

FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

COPY ./bin /inetpub/wwwroot/

RUN icacls 'C:/inetpub/wwwroot' /grant 'Everyone:(OI)(CI)F'

EXPOSE 80

WORKDIR "C:/inetpub/wwwroot/"
RUN New-Service -Name "\"CDR\""  -StartupType "\"Automatic\""  -BinaryPathName "\"C:\\inetpub\\wwwroot\\CDR_Service.exe\"";

ENTRYPOINT ["powershell"]
CMD Start-Service "\"CDR Service\""; \
    Get-EventLog -LogName System -After (Get-Date).AddHours(-1) | Format-List ;\
    $idx = (get-eventlog -LogName System -Newest 1).Index; \
    while ($true) \
    {; \
    start-sleep -Seconds 1; \
    $idx2  = (Get-EventLog -LogName System -newest 1).index; \
    get-eventlog -logname system -newest ($idx2 - $idx) |  sort index | Format-List; \
    $idx = $idx2; \
    }

我基于Stack Overflow上的模板创建了适用于该Windows服务的Dockerfile,针对应用做了必要修改后构建了镜像。运行生成的容器后,本期望能访问应用仪表盘,但每次访问都会遇到403禁止错误。


内容的提问来源于stack exchange,提问作者Caleb Utesch

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 21:55:34