【问题标题】:Unable to install IIS AspNetCoreModuleV2 in a dockerimage (and Azure Pipelines)无法在 dockerimage(和 Azure Pipelines)中安装 IIS AspNetCoreModuleV2
【发布时间】: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


【解决方案1】:

使用以下命令设置首选项变量已修复上述问题。

powershell -Command $ErrorActionPreference = 'Stop' $ProgressPreference = 'Continue'

首选项变量的值会影响 PowerShell 操作和执行 cmdLets 的方式。可能是因为容器的首选项变量的默认设置导致 PowerShell 无法完成安装。您可以在脚本中覆盖这些首选项变量。

有关首选项变量的更多信息,请参阅this document

【讨论】:

  • 非常感谢您的解释!它现在工作
猜你喜欢
  • 2019-10-10
  • 1970-01-01
  • 1970-01-01
  • 2021-08-09
  • 1970-01-01
  • 1970-01-01
  • 2019-03-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多