问题描述
安装到 Windows 容器(服务器核心)时 ODT(Office 部署工具)日志报告错误:C2R 客户端返回失败错误代码,错误代码:17002
ODT (Office Deployment Tool) log reported error when installing into Windows Container (Server Core): C2R client returned failing error code, error code: 17002
- 安装了桌面体验的 Windows Server 2019 (1809) 中的行为.
- ODT安装结果:成功.
- test-o365.ps1:成功.
- ODT安装结果:否定(C2R客户端返回失败错误码,错误码:17002)
- test-o365.ps1:否定:HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)
FROM mcr.microsoft.com/windows/servercore:ltsc2019 WORKDIR C:/setup COPY . . ENTRYPOINT startup.cmd
startup.cmd
curl.exe https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_12325-20288.exe --output . officedeploymenttool_12325-20288.exe officedeploymenttool_12325-20288.exe /quiet /passive /extract:. setup.exe /configure o365.xml powershell -file test-o365.ps1 pause
o365.xml
<Configuration> <Add OfficeClientEdition="64" Channel="Monthly"> <Product ID="O365ProPlusRetail"> <Language ID="en-us" /> </Product> </Add> <!-- <Updates Enabled="TRUE" Channel="Monthly" /> --> <Display Level="None" AcceptEULA="TRUE" /> <Logging Level="Standard" Path="." /> <!-- <Property Name="AUTOACTIVATE" Value="1" /> --> </Configuration>
test-o365.ps1
# Write current datetime into result.xlsx to verify that Office COM component is working. $filename = [System.Environment]::CurrentDirectory + " esult.xlsx" $filename if ([System.IO.File]::Exists($filename )) { Remove-Item $filename } $xl=New-Object -ComObject Excel.Application $xl.Visible=$false $wb=$xl.WorkBooks.Add() $ws=$wb.WorkSheets.item(1) $ws.Cells.Item(1,1)= [System.DateTime]::Now $wb.SaveAs($filename) $xl.Quit()
更多信息
我们已经意识到文章 [3] 中提到的Office 服务器端自动化"问题.目前,我们正在评估在 Windows 容器中运行旧版 ASP.NET 应用程序的可能性,并启用 Office/COM 互操作.
More information
We are already aware of 'server-side Automation of Office' issues as mentioned in article [3]. At current stage, we are evaluating the possibility on running legacy ASP.NET application in Windows container, with Office/COM inter-operation enabled.
- Office 部署概述工具
- 什么是Windows Server 中的服务器核心安装选项?
- 服务器注意事项- 办公自动化
推荐答案
我已经为此苦苦挣扎了一段时间,终于让它工作了.我发现 17002 错误的解决方案是运行 setup.exe/configure config.xml,同时以交互方式运行 docker 映像,然后提交该容器.这在 windows:1809 图像上对我有用.
I've been struggling with this for a while, and finally got it to work. I found the solution to the 17002 error was to run the setup.exe /configure config.xml while running the docker image interactively, and then committing that container. This worked for me on the windows:1809 image.
完整的文章
我正在将下载的 office 文件单独复制到 docker 映像中,因为我在从 docker 文件内部进行下载时遇到问题 (见这里).因此,我将文件夹
Office
与包含setup.exe/download config.xml
内容的 docker 文件处于同一级别.然后下面的 docker 文件构建一个基础镜像.我运行docker run -it {IMAGEID} powershell
,导航到 C:\odtsetup 并使用交互式控制台运行setup.exe/configure config.xml
,退出容器并运行I'm copying the downloaded office files into the docker image separately, as I was having issues with getting the download to work from inside the docker file (see here). So I have the folder
Office
at the same level as the docker file with the contents ofsetup.exe /download config.xml
. Then the docker file below builds a base image. I randocker run -it {IMAGEID} powershell
, navigate to C:\odtsetup and with the interactive console runsetup.exe /configure config.xml
, exit the container and rundocker stop {CONTAINERID} docker commit {CONTAINERID}`
我现在有一个安装了 docker 的基本 Windows 服务器映像,并且可以在我的应用程序的 dockerfile 中使用它.如果我需要更新服务器映像或 excel 版本,我需要再次手动执行此操作,但我很感激它正在工作.
I now have a base windows server image with docker installed, and can use it in the dockerfile for my application. If I need to update the server image or excel version I'll need to do this manually again, but I'm just thankful it's working.
DOCKERFILE
FROM mcr.microsoft.com/windows:1809 WORKDIR C:\odtsetup ADD https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_13426-20308.exe odtsetup.exe RUN odtsetup.exe /quiet /norestart /extract:C:\odtsetup ADD config.xml . ADD Office Office\
config.xml
<Configuration> <Add OfficeClientEdition="64" Channel="PerpetualVL2019"> <Product ID="O365ProPlusRetail"> <Language ID="MatchOS" /> <ExcludeApp ID="Access" /> <ExcludeApp ID="Groove" /> <ExcludeApp ID="Lync" /> <ExcludeApp ID="OneDrive" /> <ExcludeApp ID="OneNote" /> <ExcludeApp ID="Outlook" /> <ExcludeApp ID="PowerPoint" /> <ExcludeApp ID="Publisher" /> <ExcludeApp ID="Teams" /> <ExcludeApp ID="Word" /> </Product> </Add> <Updates Enabled="FALSE" /> <Display Level="None" AcceptEULA="TRUE" /> <Property Name="AUTOACTIVATE" Value="1"/> <Property Name="FORCEAPPSHUTDOWN" Value="TRUE" /> <Remove All="TRUE"> </Remove> </Configuration>
这篇关于将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!