我正在尝试解决发生的相同错误三年前并且没有答案。通过 GUI 或 powershell 安装 IIS 后,Install-WindowsFeature -name Web-Server -IncludeManagementTools
我收到错误:(前两行英文表示添加或删除特性时出错。操作无法完成,因为需要重新启动)
Install-WindowsFeature : Error en la solicitud para agregar o quitar características en el servidor especificado.
La operación no se puede finalizar porque es necesario reiniciar el servidor especificado.
En línea: 1 Carácter: 1
+ Install-WindowsFeature -name Web-Server -IncludeManagementTools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : DeviceError: (@{Vhd=; Credent...Name=localhost}:PSObject) [Install-WindowsFeature], Exce
ption
+ FullyQualifiedErrorId : DISMAPI_Error__Failed_Reboot_Required,Microsoft.Windows.ServerManager.Commands.AddWindow
sFeatureCommand
IIS 一直安装直到我重新启动,然后它就会回滚并卸载。
盲目尝试类似的事情DISM /Online /Cleanup-Image /RestoreHealth
是没有效果的。
这是目录:以下是大量c:\windows\logs\cbs
谷歌发现了很多相同的非错误,但没有解决方案对我有用。
运行 PS 脚本(安装之前)Get-PendingReboot 发现这里确定是否需要重新启动:
Computer : WIN-CIE9BIN05A3
CBServicing : False
WindowsUpdate : False
CCMClientSDK :
PendComputerRename : False
PendFileRename : False
PendFileRenVal :
RebootPending : False
我认为 Cbs 日志的相关部分接近结尾:
2018-01-05 03:22:10, Info CSI 00000384 Creating NT transaction (seq 8), objectname '(null)'
2018-01-05 03:22:10, Info CSI 00000385 Created NT transaction (seq 8) result 0x00000000, handle @0xf30
2018-01-05 03:22:10, Info CSI 00000386 Error STATUS_CANNOT_DELETE while executing operation DeleteFile on [l:46]'\??\C:\Windows\System32\inetsrv\apphostsvc.dll'
2018-01-05 03:22:10, Info CBS Setting ExecuteState key to: ExecuteStateNone
2018-01-05 03:22:10, Info CBS Setting RollbackFailed flag to 0
2018-01-05 03:22:10, Info CBS Clearing HangDetect value
2018-01-05 03:22:10, Info CBS Saved last global progress. Current: 0, Limit: 1, ExecuteState: ExecuteStateNone
2018-01-05 03:22:10, Info CBS Exec: Scheduled TrustedInstaller for auto-start because rollback was pended. [HRESULT = 0x00000000 - S_OK]
2018-01-05 03:22:10, Info CBS TI: CBS has signaled that a reboot is required.
2018-01-05 03:22:10, Error CBS Exec: An error occurred while committing the transaction and the transaction rollback requires a reboot. [HRESULT = 0x80070bc9 - ERROR_FAIL_REBOOT_REQUIRED]
2018-01-05 03:22:10, Info CBS Perf: InstallUninstallChain complete.
2018-01-05 03:22:10, Info CSI 00000387@2018/1/5:10:22:10.502 CSI Transaction @0x2003a2be850 destroyed
2018-01-05 03:22:10, Info CBS Failed to execute execution chain. [HRESULT = 0x80070bc9 - ERROR_FAIL_REBOOT_REQUIRED]
2018-01-05 03:22:10, Error CBS Failed to process single phase execution. [HRESULT = 0x80070bc9 - ERROR_FAIL_REBOOT_REQUIRED]
2018-01-05 03:22:10, Info CBS WER: Generating failure report for package: Microsoft-Windows-Foundation-Package~31bf3856ad364e35~amd64~~10.0.14393.0, status: 0x80070bc9, failure source: Execute, start state: Installed, target state: Installed, client id: DISM Package Manager Provider
2018-01-05 03:22:10, Info CBS Not able to query DisableWerReporting flag. Assuming not set... [HRESULT = 0x80070002 - ERROR_FILE_NOT_FOUND]
2018-01-05 03:22:10, Info CBS Added C:\Windows\Logs\CBS\CBS.log to WER report.
2018-01-05 03:22:10, Info CBS Added C:\Windows\Logs\CBS\CbsPersist_20180104154517.log to WER report.
2018-01-05 03:22:10, Info CBS Added C:\Windows\Logs\CBS\CbsPersist_20180104142952.log to WER report.
2018-01-05 03:22:10, Info CBS Added C:\Windows\Logs\CBS\CbsPersist_20180103145329.log to WER report.
2018-01-05 03:22:10, Info CBS Added C:\Windows\Logs\CBS\CbsPersist_20171231105556.log to WER report.
2018-01-05 03:22:10, Info CBS Not able to add %windir%\winsxs\pending.xml.bad to WER report. [HRESULT = 0x80070002 - ERROR_FILE_NOT_FOUND]
2018-01-05 03:22:11, Info CBS FinalCommitPackagesState: Started persisting state of packages
2018-01-05 03:22:11, Info CBS TI: CBS has queried the current reboot required state: 1
日志中的几行是另一个可能的想法:我已经从 VS 安装了 IIS express,并且看起来 Express 文件夹可能会干扰安装。
2018-01-05 03:22:08, Info CBS FLOW: Enter Installation Stage: Primitive Installer Analysis, Current Operation Stage: Installing
2018-01-05 03:22:08, Info CSI 00000368@2018/1/5:10:22:08.813 CSIPERF - FileMapsCreated 325ms
2018-01-05 03:22:08, Info CSI 00000369 Unable to delete directory [l:28 ml:29]'\??\C:\inetpub\custerr\en-US'; it is still owned by component Microsoft-Windows-IIS-HttpErrorsBinaries.Resources, version 10.0.14393.0, arch amd64, culture [l:5]'en-US', nonSxS, pkt {l:8 b:31bf3856ad364e35}
2018-01-05 03:22:08, Info CSI 0000036a Unable to delete directory \??\C:\inetpub\history; file CFGHISTORY_0000000001 exists
2018-01-05 03:22:08, Info CSI 0000036b Unable to delete directory \??\C:\inetpub\temp\appPools; file APCD57C.tmp exists
2018-01-05 03:22:08, Info CSI 0000036c Unable to delete directory \??\C:\inetpub; file custerr exists
2018-01-05 03:22:08, Info CSI 0000036d Unable to delete directory [l:29 ml:30]'\??\C:\Windows\Inf\W3SVC\0C0A'; it is still owned by component Microsoft-Windows-IIS-W3SVC.Resources, version 10.0.14393.0, arch amd64, culture [l:5]'es-ES', nonSxS, pkt {l:8 b:31bf3856ad364e35}
2018-01-05 03:22:08, Info CSI 0000036e Unable to delete directory \??\C:\Windows\Inf\W3SVC; file 0C0A exists
2018-01-05 03:22:08, Info CSI 0000036f Unable to delete directory [l:37 ml:38]'\??\C:\Windows\System32\inetsrv\en-US'; it is still owned by component Microsoft-Windows-IIS-ASPBinaries.Resources, version 10.0.14393.0, arch amd64, culture [l:5]'en-US', nonSxS, pkt {l:8 b:31bf3856ad364e35}
2018-01-05 03:22:08, Info CSI 00000370 Unable to delete directory [l:37 ml:38]'\??\C:\Windows\System32\inetsrv\es-ES'; it is still owned by component Microsoft-Windows-IIS-ASPBinaries.Resources, version 10.0.14393.0, arch amd64, culture [l:5]'es-ES', nonSxS, pkt {l:8 b:31bf3856ad364e35}
2018-01-05 03:22:08, Info CSI 00000371 Unable to delete directory [l:37 ml:38]'\??\C:\Windows\SysWOW64\inetsrv\en-US'; it is still owned by component Microsoft-Windows-IIS-ASPBinaries.Resources, version 10.0.14393.0, arch Host= amd64 Guest= x86, culture [l:5]'en-US', nonSxS, pkt {l:8 b:31bf3856ad364e35}
2018-01-05 03:22:08, Info CSI 00000372 Unable to delete directory [l:37 ml:38]'\??\C:\Windows\SysWOW64\inetsrv\es-ES'; it is still owned by component Microsoft-Windows-IIS-ASPBinaries.Resources, version 10.0.14393.0, arch Host= amd64 Guest= x86, culture [l:5]'es-ES', nonSxS, pkt {l:8 b:31bf3856ad364e35}
结果:卸载 IIS express 并没有修复安装。