I'm writing some CustomActions in WiX to migrate a web.config from IIS6 to IIS7 and am getting an error. However if I copy and paste the failing command from the install log file, it succeeds. Here's section of the log file that indicates the error. You'll see the first two appcmds succeed but the last migration command fails.
Action 10:43:52: UnlockModulesCmd.
Action start 10:43:52: UnlockModulesCmd.
MSI (s) (80:44) [10:43:52:631]: PROPERTY CHANGE: Adding QtExecCmdLine property. Its value is '"C:\Windows\system32\inetsrv\appcmd" unlock config -section:system.webServer/modules'.
Action ended 10:43:52: UnlockModulesCmd. Return value 1.
MSI (s) (80:44) [10:43:52:641]: Doing action: UnlockModules
Action 10:43:52: UnlockModules. Migrating to IIS7
Action start 10:43:52: UnlockModules.
MSI (s) (80:44) [10:43:52:691]: Creating MSIHANDLE (834) of type 790542 for thread 2116
MSI (s) (80:B8) [10:43:52:691]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI72FF.tmp, Entrypoint: CAQuietExec
MSI (s) (80!7C) [10:43:52:771]: Creating MSIHANDLE (835) of type 790541 for thread 892
MSI (s) (80!7C) [10:43:52:771]: Creating MSIHANDLE (836) of type 790531 for thread 892
MSI (s) (80!7C) [10:43:52:781]: Closing MSIHANDLE (836) of type 790531 for thread 892
MSI (s) (80!7C) [10:43:52:781]: PROPERTY CHANGE: Deleting QtExecCmdLine property. Its current value is '"C:\Windows\system32\inetsrv\appcmd" unlock config -section:system.webServer/modules'.
MSI (s) (80!7C) [10:43:53:752]: Creating MSIHANDLE (837) of type 790531 for thread 892
CAQuietExec: Unlocked section "system.webServer/modules" at configuration path "MACHINE/WEBROOT/APPHOST".
MSI (s) (80!7C) [10:43:53:762]: Closing MSIHANDLE (837) of type 790531 for thread 892
MSI (s) (80!7C) [10:43:53:762]: Closing MSIHANDLE (835) of type 790541 for thread 892
MSI (s) (80:B8) [10:43:53:762]: Closing MSIHANDLE (834) of type 790542 for thread 2116
Action ended 10:43:53: UnlockModules. Return value 1.
MSI (s) (80:44) [10:43:53:772]: Doing action: UnlockHandlersCmd
Action 10:43:53: UnlockHandlersCmd.
Action start 10:43:53: UnlockHandlersCmd.
MSI (s) (80:44) [10:43:53:792]: PROPERTY CHANGE: Adding QtExecCmdLine property. Its value is '"C:\Windows\system32\inetsrv\appcmd" unlock config -section:system.webServer/handlers'.
Action ended 10:43:53: UnlockHandlersCmd. Return value 1.
MSI (s) (80:44) [10:43:53:792]: Doing action: UnlockHandlers
Action 10:43:53: UnlockHandlers. Migrating to IIS7
Action start 10:43:53: UnlockHandlers.
MSI (s) (80:44) [10:43:53:862]: Creating MSIHANDLE (838) of type 790542 for thread 2116
MSI (s) (80:08) [10:43:53:862]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI7780.tmp, Entrypoint: CAQuietExec
MSI (s) (80!60) [10:43:54:123]: Creating MSIHANDLE (839) of type 790541 for thread 2144
MSI (s) (80!60) [10:43:54:123]: Creating MSIHANDLE (840) of type 790531 for thread 2144
MSI (s) (80!60) [10:43:54:123]: Closing MSIHANDLE (840) of type 790531 for thread 2144
MSI (s) (80!60) [10:43:54:133]: PROPERTY CHANGE: Deleting QtExecCmdLine property. Its current value is '"C:\Windows\system32\inetsrv\appcmd" unlock config -section:system.webServer/handlers'.
MSI (s) (80!60) [10:43:54:493]: Creating MSIHANDLE (841) of type 790531 for thread 2144
CAQuietExec: Unlocked section "system.webServer/handlers" at configuration path "MACHINE/WEBROOT/APPHOST".
MSI (s) (80!60) [10:43:54:503]: Closing MSIHANDLE (841) of type 790531 for thread 2144
MSI (s) (80!60) [10:43:54:503]: Closing MSIHANDLE (839) of type 790541 for thread 2144
MSI (s) (80:08) [10:43:54:513]: Closing MSIHANDLE (838) of type 790542 for thread 2116
Action ended 10:43:54: UnlockHandlers. Return value 1.
MSI (s) (80:44) [10:43:54:634]: Doing action: MigrateIIS7Cmd
Action 10:43:54: MigrateIIS7Cmd.
Action start 10:43:54: MigrateIIS7Cmd.
MSI (s) (80:44) [10:43:54:644]: PROPERTY CHANGE: Adding QtExecCmdLine property. Its value is '"C:\Windows\system32\inetsrv\appcmd" migrate config "Default Web Site/sdportal"'.
Action ended 10:43:54: MigrateIIS7Cmd. Return value 1.
MSI (s) (80:44) [10:43:54:654]: Doing action: MigrateIIS7
Action 10:43:54: MigrateIIS7. Migrating to IIS7
Action start 10:43:54: MigrateIIS7.
MSI (s) (80:44) [10:43:54:704]: Creating MSIHANDLE (842) of type 790542 for thread 2116
MSI (s) (80:E8) [10:43:54:704]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI7ADE.tmp, Entrypoint: CAQuietExec
MSI (s) (80!14) [10:43:54:714]: Creating MSIHANDLE (843) of type 790541 for thread 2068
MSI (s) (80!14) [10:43:54:724]: Creating MSIHANDLE (844) of type 790531 for thread 2068
MSI (s) (80!14) [10:43:54:724]: Closing MSIHANDLE (844) of type 790531 for thread 2068
MSI (s) (80!14) [10:43:54:724]: PROPERTY CHANGE: Deleting QtExecCmdLine property. Its current value is '"C:\Windows\system32\inetsrv\appcmd" migrate config "Default Web Site/sdportal"'.
MSI (s) (80!14) [10:43:55:755]: Creating MSIHANDLE (845) of type 790531 for thread 2068
CAQuietExec: Error 0x80070001: Command line returned an error.
MSI (s) (80!14) [10:43:55:765]: Closing MSIHANDLE (845) of type 790531 for thread 2068
MSI (s) (80!14) [10:43:55:765]: Creating MSIHANDLE (846) of type 790531 for thread 2068
CAQuietExec: Error 0x80070001: CAQuietExec Failed
MSI (s) (80!14) [10:43:55:775]: Closing MSIHANDLE (846) of type 790531 for thread 2068
MSI (s) (80!14) [10:43:55:775]: Closing MSIHANDLE (843) of type 790541 for thread 2068
MSI (s) (80:E8) [10:43:55:775]: Closing MSIHANDLE (842) of type 790542 for thread 2116
Action ended 10:43:55: MigrateIIS7. Return value 1.
Here's a follow up. I was able to get appcmd to work by requiring the installer be run as admin. Recently, I added an 开发者_如何学Cadditional custom command which fails. Here's the relevant portion of the log. Note that the other appcmd.exe commands run fine. If I copy and past the failing appcmd from the log to a command line prompt, it works. Any thoughts?
MSI (s) (1C:B0) [15:56:46:510]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIB74D.tmp, Entrypoint: CAQuietExec
MSI (s) (1C!B8) [15:56:46:570]: PROPERTY CHANGE: Deleting QtExecCmdLine property. Its current value is '"C:\Windows\system32\inetsrv\appcmd" migrate config "Default Web Site/sdportal"'.
CAQuietExec: Error 0x80070001: Command line returned an error.
CAQuietExec: Error 0x80070001: CAQuietExec Failed
Action ended 15:56:47: MigrateIIS7. Return value 1.
MSI (s) (1C:14) [15:56:47:001]: Doing action: DisableRapidFailCmd
Action 15:56:47: DisableRapidFailCmd.
Action start 15:56:47: DisableRapidFailCmd.
MSI (s) (1C:14) [15:56:47:011]: PROPERTY CHANGE: Adding QtExecCmdLine property. Its value is '"C:\Windows\system32\inetsrv\appcmd" set apppool "WssAppPool" /failure.rapidFailProtection:false'.
Action ended 15:56:47: DisableRapidFailCmd. Return value 1.
MSI (s) (1C:14) [15:56:47:021]: Doing action: DisableRapidFail
Action 15:56:47: DisableRapidFail. Disabling Rapid Fail
Action start 15:56:47: DisableRapidFail.
MSI (s) (1C:30) [15:56:47:061]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIB988.tmp, Entrypoint: CAQuietExec
MSI (s) (1C!64) [15:56:47:141]: PROPERTY CHANGE: Deleting QtExecCmdLine property. Its current value is '"C:\Windows\system32\inetsrv\appcmd" set apppool "WssAppPool" /failure.rapidFailProtection:false'.
CAQuietExec: APPPOOL object "WssAppPool" changed
Action ended 15:56:47: DisableRapidFail. Return value 1.
MSI (s) (1C:14) [15:56:47:502]: Doing action: ConfigureAppPoolLoggingCmd
Action 15:56:47: ConfigureAppPoolLoggingCmd.
Action start 15:56:47: ConfigureAppPoolLoggingCmd.
MSI (s) (1C:14) [15:56:47:522]: PROPERTY CHANGE: Adding QtExecCmdLine property. Its value is '"C:\Windows\system32\inetsrv\appcmd" set config /section:applicationPools /[name='WssAppPool'].recycling.logEventOnRecycle:Memory,Schedule,Requests,Time,PrivateMemory'.
Action ended 15:56:47: ConfigureAppPoolLoggingCmd. Return value 1.
MSI (s) (1C:14) [15:56:47:522]: Doing action: ConfigureAppPoolLogging
Action 15:56:47: ConfigureAppPoolLogging. Configuring App Pool Logging
Action start 15:56:47: ConfigureAppPoolLogging.
MSI (s) (1C:C0) [15:56:47:562]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIBB7E.tmp, Entrypoint: CAQuietExec
MSI (s) (1C!A8) [15:56:47:602]: PROPERTY CHANGE: Deleting QtExecCmdLine property. Its current value is '"C:\Windows\system32\inetsrv\appcmd" set config /section:applicationPools /[name='WssAppPool'].recycling.logEventOnRecycle:Memory,Schedule,Requests,Time,PrivateMemory'.
CAQuietExec: ERROR ( message:Unknown attribute ".recycling.logEventOnRecycle". Replace with -? for help. )
CAQuietExec: Error 0x80070585: Command line returned an error.
CAQuietExec: Error 0x80070585: CAQuietExec Failed
First, you cannot use CAQuietExec even if UAC is disabled, since it will not run with the correct rights. Simply execute the appcmd without using CAQuietExec.
Secondly, here is how to do it correctly: http://esmithy.net/2010/07/02/iis-configuration-with-wix-and-appcmd/
Copy/paste in case the blog disappears:
<InstallExecuteSequence><Custom Action="ConfigureAppPools" Before="InstallFinalize"><![CDATA[NOT Installed AND VersionNT64 >= 600]]></Custom></InstallExecuteSequence>
<CustomAction Id="ConfigureAppPools" Execute="deferred" Impersonate="no" Return="check" Directory="TARGETDIR" ExeCommand="[SystemFolder]inetsrv\appcmd set apppool /apppool.name:"[APPPOOLNAME]" /enable32BitAppOnWin64:true" />
This is what I found on a wix-users mail archive. It seems to be very similar problem. Try to define the custom action the way Phil suggests.
精彩评论