MSI安装成功但未部署Windows服务,事件日志存在MsiExec错误
Hey there, let's break down why your MSI is reporting success but failing to install those two Windows services—especially since it's worked hundreds of times before. Here are actionable steps to diagnose and fix the issue:
Generate a detailed MSI installation log
The default success message doesn't tell the whole story. Run your installer with verbose logging enabled to capture every step of the process:msiexec /i YourInstaller.msi /l*v full_install.logLook for entries related to your service installation custom actions—you'll likely see clues like failed registry writes, missing dependencies, or permission errors that weren't surfaced in the UI.
Verify custom action execution context
Most MSIs use custom actions to callinstallutil.exefor service registration. If this action runs in the wrong context (e.g., user-level instead of system-level), it won't have the permissions needed to create services. Check your MSI's custom action settings:- Ensure it's scheduled in the
InstallExecuteSequence(notInstallUISequence) - Set the action to run in Deferred mode with the
NoImpersonateproperty enabled—this forces it to run under the system account, which has the required privileges.
- Ensure it's scheduled in the
Check 64-bit compatibility
Even on a 64-bit server, a 32-bit MSI might be calling the 32-bit version ofinstallutil.exe(fromC:\Windows\Microsoft.NET\Framework\), which can hit registry redirection issues. Confirm:- If your MSI is marked as x86, update the custom action to point to the 64-bit
installutil.exeatC:\Windows\Microsoft.NET\Framework64\v[Your.NETVersion]\InstallUtil.exe - Alternatively, rebuild your MSI as a 64-bit package if your services are compiled for x64.
- If your MSI is marked as x86, update the custom action to point to the 64-bit
Dig into the event log errors
You mentioned finding errors in the event log—even partial details can be critical. Common red flags include:- "Custom action [ActionName] failed" with exit code 1603 (general failure)
- Permission denied errors when writing to
HKLM\System\CurrentControlSet\Services - File not found errors for your service executable or dependent DLLs
Validate service dependencies
When you install manually withinstallutil, your local environment might have missing dependencies that the MSI isn't deploying. Compare the output of your manualinstallutilrun to the MSI log—look for warnings about missing assemblies that the MSI failed to install alongside your services.Reset Windows Installer components
Rarely, corruption in the Windows Installer service can cause silent failures. Try:- Restart the Windows Installer service (run
services.msc, find "Windows Installer", restart it) - Run
sfc /scannowto repair any corrupted system files related to Windows Installer
- Restart the Windows Installer service (run
If you can share the specific event log errors or key snippets from the verbose MSI log, we can narrow this down even further!
内容的提问来源于stack exchange,提问作者rgeorg

