wix custom action to remove http binding

258 Views Asked by At

I have a Wix installer to deploy my application in IIS. I want to remove HTTP binding when it deploys.

Below is the cmd command that helps in removing the HTTP binding: “set site /site.name:"My Project Management" /-bindings.[protocol='http',bindingInformation='*:80:']”

I want the same thing happen via wix custom action.Something like below:

<CustomAction Name="RemoveHttp_Cmd" Schedule="Before" Reference="RemoveHttp" Condition="Installed">
  <Definition Property="RemoveHttp" Execute="immediate" Value="&quot;[WindowsFolder]system32\inetsrv\appcmd.exe&quot; set site /name:&quot;My Project Management&quot; /-bindings:&quot;http/*:80:&quot;" />
</CustomAction>
<CustomAction Name="RemoveHttp" Schedule="Before" Reference="CreateAppPool" Condition="Installed">
  <Definition BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" />
</CustomAction>

It should ideally remove the binding but actually, it is not. Please suggest the right way to do.

1

There are 1 best solutions below

1
Christopher Painter On

You might want to look at the IIS Rewrite module. It's been my experience that you can use a bootstrapper to install the module if it isn't present and with just a little bit of XML in your applications web.config set up a rule to rewrite http to https or rewrite it to a not supported page. No installer work beyond making sure the rewrite module is present should be needed.