【问题标题】:Cannot install .NET 3.5 on Windows Server 2012 R2 with Chef Test Kitchen无法在带有 Chef Test Kitchen 的 Windows Server 2012 R2 上安装 .NET 3.5
【发布时间】:2017-01-20 12:48:43
【问题描述】:

我找不到在 Windows Server 2012 R2 上安装带有 Chef Test Kitchen 的 .NET 3.5 的方法。

我可以从命令行安装框架

C:\Windows\system32\dism.exe /online /enable-feature /featurename:NetFx3 /norestart /All /source:"C:\Users\admin\AppData\Local\Temp\dotnetfx35.exe"

或从 PowerShell 提示符使用

Install-WindowsFeature –name NET-Framework-Core –source "C:\Users\admin\AppData\Local\Temp\dotnetfx35.exe"

但如果我在 chef 中执行以下任何操作,我会收到相同的错误:

部署镜像服务和管理工具

版本:6.3.9600.17031

镜像版本:6.3.9600.17031

启用功能

错误:0x800f0906

无法下载源文件。

使用“源”选项指定文件的位置 需要恢复该功能。有关指定 源位置,见http://go.microsoft.com/fwlink....

我已将 dotnetfx35.exe 复制到用户的临时目录 C:\Users\admin\AppData\Local\Temp\dotnetfx35.exe

主厨 --version

Chef 开发套件版本:0.15.16

主厨客户端版本:12.11.18

交付版本:master (444effdf9c81908795e88157f01cd667a6c43b5f)

berks 版本:4.3.5 厨房版本:1.7.3

到目前为止我尝试过的资源:

使用 Chocolatey

chocolatey_package 'dotnet3.5' do
  options "--allow-empty-checksums --ignore-package-exit-codes"
end

执行

  execute 'install_dot_net_3-5' do
    command "C:\\Windows\\system32\\dism.exe /online /enable-feature /featurename:NetFx3 /norestart /All /source:\"C:\\Users\\admin\\AppData\\Local\\Temp\\dotnetfx35.exe\""
    timeout 9999
  end

批次

  batch 'install_dot_net_3-5' do
    code <<-EOH
      C:\\Windows\\system32\\dism.exe /online /enable-feature /featurename:NetFx3 /norestart /All /source:"C:\\Users\\admin\\AppData\\Local\\Temp\\dotnetfx35.exe"
    EOH
    cwd "#{ENV['TEMP']}"
    timeout 9999
  end

Powershell 脚本

  powershell_script 'install_dot_net_3-5' do
    code <<-EOH
      Install-WindowsFeature –name NET-Framework-Core –source "C:\\Users\\admin\\AppData\\Local\\Temp\\dotnetfx35.exe"
    EOH
  end

【问题讨论】:

  • 测试厨房在 VM 中运行厨师食谱。任何临时文件都可能不可用,并且 vm 可能存在互联网访问问题。您是在测试厨房还是在您的机器上运行上述内容?

标签: .net-3.5 chef-infra


【解决方案1】:

非常感谢来自 Chef 的 Matt Wrock,他给了我答案:

如果您尝试通过测试厨房安装 .net 3.5,请使用 高架winrm传输。这将允许通过 .net 3.5 访问 Windows 更新无需指向源文件。消除 dism 命令中的源参数并将其添加到您的 .kitchen.yml:

transport:
  name: winrm
  elevated: true

elevated: true 添加到 .kitchen.yml 文件后,我已在 Test Kitchen 的 Windows Server 2012 R2 上成功安装了 .NET 3.5,配方中包含以下代码。相同的配方适用于生产盒上的 Chef Client。

  powershell_script 'install_dot_net_3-5' do
    code <<-EOH
      Install-WindowsFeature -name NET-Framework-Core
    EOH
  end

【讨论】:

    猜你喜欢
    • 2016-08-01
    • 1970-01-01
    • 2014-07-01
    • 2017-01-27
    • 2014-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-15
    相关资源
    最近更新 更多