WiX CustomAction ExeCommand Error?

I have a command line that I want to run during the installation of a merge module (generated by WiX ) using the code below.

<CustomAction
    Id='SetWebsiteProtocols'
    Execute='commit'
    Return='ignore'
    Impersonate="yes"
    FileKey='Web.config'
    ExeCommand='c:\windows\system32\inetsrv\appcmd.exe set app "Default Web Site/My Website" /enabledProtocols:http,net.tcp,net.pipe' />

<InstallExecuteSequence>
    <Custom Action="SetWebsiteProtocols" After="InstallFiles"/>
</InstallExecuteSequence>

      

When I run the command on the command line (hardcoded at the moment) it works fine. However, when launched during installation, it fails. Enabling logging shows error code 1721, but googling that returns nothing interesting.

How do I fix this problem?

+3


source to share


1 answer


I see a lot of problems with your code.

  • You are scheduled for a commit that will not be processed if rollback is disabled by policy.

  • You are aware of the UAC that can fail in UAC / elevated situations if your consuming MSI is not booted with setup.exe

    which brings up the UI / Execute process.

  • You have set the path to a folder system32

    , which may be missing because WINDOWS does not need to be named WINDOWS, or could be a 32-bit or 64-bit system folder depending on the OS platform.

  • You are ignoring the return code, so if that doesn't work, your installation will continue. Connect and pray for someone?

  • During installation, you will have a big ugly blinking black console window that just screams, "Oh, this guy didn't know what he was doing."

  • You will get absolutely no output from the EXE.

  • You are probably not aware of the problems that can arise directly when invoking a custom EXE action.

Here are some readings to help you understand these issues:

Now, I would also mention that you might be reinventing the wheel, but it seems that the WiX IIS custom actions are not displaying the variation point you want. It's a shame. So I would like to suggest the following function to fix your EXE call:



I believe this is a very elegant way to invoke your EXE without flashing DOS , entering your MSI log correctly, and fixing many Microsoft EXE issues. From there, you just need to fix it so that you correctly enable the correct 32 bit or 64 bit appcmd. My installers only target server 2008 R2, which is 64 bit only platform, so my code looks like this:

(This code augments something InstallShield doesn't reveal ...)

<CustomAction Id="SetIISAuthCAD"
              Property="SetIISAuth"
              Value="&quot;[System64Folder]inetsrv\appcmd.exe&quot; set config &quot;Default Web Site/MyApplication&quot; /section:system.webServer/security/authentication/windowsAuthentication /useAppPoolCredentials:true /commit:MACHINE/WEBROOT/APPHOST " />
<CustomAction Id="SetIISAuth"
              BinaryKey="WixCA"
              DllEntry="CAQuietExec64"
              Execute="deferred"
              Return="ignore"
              Impersonate="no" />
<InstallExecuteSequence>
    <Custom Action="SetIISAuth"
            Before="InstallFinalize">Not Installed</Custom>
    <Custom Action="SetIISAuthCAD"
            Before="SetIISAuth">Not Installed</Custom>
</InstallExecuteSequence>

      

+10


source







All Articles