在创建新网站之前,WiX会删除默认的IIS网站

Ily*_*din 5 iis wix wix3.7

我为我的网站创建了一个WiX软件包,它运行正常,只是我新创建的网站在安装后没有启动.那是因为我的网站注册使用*:80.默认情况下,IIS具有相同绑定的网站设置.

有没有办法在创建我的新网站绑定之前删除默认网站(或至少停止它)?我似乎无法在互联网上找到任何相关信息,但这似乎是一个常见的问题.

Joh*_*ris 1

我找到了如何做到这一点,我想我可以为任何疲惫的旅行者提供答案:

<CustomAction Id="RegisterCommand"
              Property="RegisterPowerShellProperty"
                                Execute="immediate"
                                Value="&quot;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe&quot; -ExecutionPolicy ByPass -NoLog -InputFormat None -NoProfile -command &quot;Remove-IISSite -Name 'Default Web Site' -Confirm:$false&quot;"/>
<CustomAction Id="RegisterPowerShellProperty"
              BinaryKey="WixCA"
              DllEntry="CAQuietExec64"
              Execute="deferred"
              Return="check"
              Impersonate="no" />

<InstallExecuteSequence>
        <Custom Action="RegisterCommand" After="CostFinalize">NOT Installed</Custom>
       <Custom Action="RegisterPowerShellProperty" After="InstallFiles">NOT  Installed</Custom>     
</InstallExecuteSequence>
Run Code Online (Sandbox Code Playgroud)

我的回答基于这篇文章: 这里