​IIS restart with WiX​

Really simple WiX sample for restarting IIS:

<Component Id="WebserviceRestart" Guid="<GUID>" KeyPath="yes">

       <ServiceControl Id="StopWeb1" Name="W3SVC" Stop="install">       

       </ServiceControl>

       <ServiceControl Id="StartWeb1" Name="W3SVC" Start="install">       

       </ServiceControl>

      </Component>

<Feature Id="DefaultFeature" Level="1" ConfigurableDirectory="TARGETDIR">

 <ComponentRef Id="WebserviceRestart" />

 </Feature>

I needed to update a web.config file of a MapXtreme 2004 application. There is a known bug with this application in that it dies when the web.config is touched and the application restarts.

[Updated 21st June, Thanks to ​​Rob Mensching ​​for the comment]


posted on Friday, 18 June 2004 12:35 PM

​#​​​ re: IIS restart with WiX 20/06/2004 12:41 PM ​​Rob Mensching​

Daniel,


Is there a particular reason you chose to create two Components to start and stop the service? In this case, since the Components are part of the same Feature it seems like it would make more sense to use a single Component to start and stop the service. That would cut down on Component bloat in your MSI.