简体   繁体   English

无法在 dockerimage 中安装 IIS AspNetCoreModuleV2(和 Azure 管道)

[英]Unable to install IIS AspNetCoreModuleV2 in a dockerimage (and Azure Pipelines)

I have a problem for few days now with the "dotnet hosting bundle" and AspNetCoreV2 IIS module in a dockerimage.几天来,我在 dockerimage 中遇到了“dotnet 托管包”和 AspNetCoreV2 IIS 模块的问题。

So, I creating a dockerimage with many IIS modules and requirements to execute our software.因此,我创建了一个包含许多 IIS 模块和执行我们软件的要求的 dockerimage。 The dockerimage works good expect this AspNetCoreV2 module. dockerimage 运行良好,期待这个 AspNetCoreV2 模块。 When the container created, I check the modules installed with Get-WebGlobalModule and doesn't appear.创建容器时,我检查了使用Get-WebGlobalModule安装的模块并且没有出现。 But, when I start the quiet (or passive) installation manualy, into the container, this module works and appear in the IIS Module list.但是,当我手动启动安静(或被动)安装到容器中时,该模块工作并出现在 IIS 模块列表中。

I tried many solutions to do that (multistage with aspnetcore Microsoft images, last version of dotnet_hosting_bundle.exe and many other, but same issue).我尝试了许多解决方案来做到这一点(使用 aspnetcore Microsoft 映像的多阶段、dotnet_hosting_bundle.exe 的最新版本和许多其他但同样的问题)。

I tried to automatise the docker exec process to install this module manualy and commit it with Azure Pipelines and Windows agent in a VM, but doesn't work:(. To try that, I use different way:我试图自动化 docker 执行过程以手动安装此模块并使用 Azure 管道和 Windows 代理提交它(尝试在 VM 中使用不同的方式,但我使用不同的方式:

      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

In the Start-Process, I can see:在启动过程中,我可以看到: 在此处输入图像描述 The process is created but apparently not started该过程已创建但显然未启动

I also tried with: cmd 'C:\Program Files\MySoftware\PowerShell\Installer.Prerequisites\dotnet-hosting-3.1.2-win.exe' /quiet /install我也试过: cmd 'C:\Program Files\MySoftware\PowerShell\Installer.Prerequisites\dotnet-hosting-3.1.2-win.exe' /quiet /install

This task in Azure Pipeline working without error, but when I download this new image (pushed after these instructions), the module doesn't appear in Get-WebGlobalModule Azure 管道中的此任务正常工作,但是当我下载这个新图像(按照这些说明推送)时,模块没有出现在Get-WebGlobalModule

Also, the module is not presend into ProgramFiles此外,该模块未提交到 ProgramFiles

I don't really understand how can I install this module.我真的不明白如何安装这个模块。 All other modules working, expect this...所有其他模块都在工作,期待这个......

Thanks you very much in advance for your advises.非常感谢您的建议。

Best最好的

Set the preference variables with below command fixed above issue.使用已修复上述问题的以下命令设置首选项变量。

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

The values of the preference variables affect how PowerShell operates and executes cmdLets.首选项变量的值会影响 PowerShell 操作和执行 cmdLets 的方式。 It might be because the default settings of the preference variables of the container that caused the PowerShell failing to complete the installation.可能是因为容器的首选项变量的默认设置导致 PowerShell 无法完成安装。 You can override these preference variables in your script.您可以在脚本中覆盖这些首选项变量。

Please see this document for more information about Preference Variables.有关首选项变量的更多信息,请参阅此文档

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

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