1

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.

  • Haven't done IIS in a long time. Are you familiar with WiX's IIS extension? [See sample code](https://github.com/rstropek/Samples/blob/master/WiXSamples/WebInstaller/Setup/Product.wxs) - towards bottom. [IIS Schema](https://wixtoolset.org/documentation/manual/v3/xsd/iis/) (documentation). I am not sure you can do what you ask with this schema, but you should use it for all IIS features WiX supports. [Some further links](https://stackoverflow.com/a/25005864/129130). – Stein Åsmul May 30 '19 at 19:40
  • `Condition="Installed"` will only work upon repair/uninstallation. Is it what you're expecting? – montonero May 31 '19 at 07:59
  • Have you considered leaving the HTTP binding and implementing a redirect to the HTTPS? I have some internal apps at work that implemented only HTTPS and it's a real annoyance. – Christopher Painter Jun 02 '19 at 12:27
  • @christopher , yes I have but I was looking for a solution that restrict http.Something like "the site can't be reached" when you browse http – Nikita Chaudhary Jun 03 '19 at 13:16
  • Based on that please see my answer below. – Christopher Painter Jun 03 '19 at 16:04

1 Answers1

0

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.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Great input. could you help here https://stackoverflow.com/questions/57294132/how-to-update-appsettings-json-from-wix-custom-actions-with-the-values-passed-as – kudlatiger Aug 01 '19 at 11:01