【发布时间】:2021-02-08 10:42:50
【问题描述】:
我在 dockerimage 中遇到了“dotnet 托管包”和 AspNetCoreV2 IIS 模块的问题。
所以,我创建了一个包含许多 IIS 模块和要求的 dockerimage 来执行我们的软件。 dockerimage 运行良好,期待这个 AspNetCoreV2 模块。创建容器时,我检查了使用Get-WebGlobalModule 安装的模块并且没有出现。
但是,当我手动启动静默(或被动)安装到容器中时,该模块可以工作并出现在 IIS 模块列表中。
我尝试了许多解决方案来做到这一点(使用 aspnetcore Microsoft 映像的多阶段、dotnet_hosting_bundle.exe 的最新版本和许多其他但同样的问题)。
我尝试自动化 docker exec 进程以手动安装此模块并在 VM 中使用 Azure Pipelines 和 Windows 代理提交它,但不起作用:(。 为了尝试,我使用了不同的方式:
docker stop mycontainer
docker rm mycontainer
docker run --name mycontainer -d -it $(containerRegistry)/$(container_requirement_name):v1.0.$(Build.BuildId)
docker exec mycontainer powershell.exe -command Start-Process -FilePath 'C:\Program Files\MySoftware\PowerShell\Installer.Prerequisites\dotnet-hosting-3.1.2-win.exe' -ArgumentList "/passive","/install","/norestart" -PassThru -Wait
docker stop mycontainer
docker commit mycontainer $(containerRegistry)/$(container_requirement_name):v1.0.$(Build.BuildId).1
我也尝试过:cmd 'C:\Program Files\MySoftware\PowerShell\Installer.Prerequisites\dotnet-hosting-3.1.2-win.exe' /quiet /install
Azure Pipeline 中的此任务正常运行,但是当我下载此新图像(按照这些说明推送)时,该模块未出现在 Get-WebGlobalModule
另外,该模块没有提交到 ProgramFiles 中
我真的不明白如何安装这个模块。所有其他模块都在工作,期待这个......
非常感谢您的建议。
最好的
【问题讨论】:
-
请先尝试在powershell中设置偏好变量。
powershell -Command $ErrorActionPreference = 'Stop' $ProgressPreference = 'Continue' $verbosePreference='Continue' -
谢谢!使用此命令,它可以在 Azure Pipelines 中使用 Azure 代理(由管道自动分配),但不适用于安装在 VM 上的自定义代理。真奇怪。另外,你能快速解释一下为什么它可以使用这个命令吗? :)
标签: asp.net docker iis azure-pipelines