IIS website physical path becomes empty when wix is ​​uninstalled

Background: I have a Wix installer where a virtual directory is created on an existing IIS website. A virtual directory is created (it does not exist before installation), but the IIS website must already be created (the user simply selects the site to install in the ListBox).

Problem: when deleting, the physical path on the IIS website that was installed becomes empty, there is no value for this attribute. Below is the version of my main wix file. I'm not sure why removal affects the IIS site, but any thoughts are appreciated.

Notes: I'm on Wix 3.5 and Windows Server 2008 R2, IIS 7.

<Product> <Property Id='WEBSITE_DESCRIPTION'> <RegistrySearch Id='RememberPropertyWEBSITE_DESCRIPTION' Root='HKCU' Key='SOFTWARE\Company\Product' Name='InstalledWebsiteDescription' Type='raw' /> </Property> <Property Id='WEBSITE_PORT'> <RegistrySearch Id='RememberPropertyWEBSITE_PORT' Root='HKCU' Key='SOFTWARE\Company\Product' Name='InstalledWebsitePort' Type='raw' /> </Property> <Component Id='PropertiesToSave' Directory='ApplicationFolder'> <RegistryValue Root='HKCU' Key='SOFTWARE\Company\Product' Name='InstalledWebsiteDescription' Value='[WEBSITE_DESCRIPTION]' Type='string' /> <RegistryValue Root='HKCU' Key='SOFTWARE\Company\Product' Name='InstalledWebsitePort' Value='[WEBSITE_PORT]' Type='string' /> <RemoveFolder Id='CleanupApplicationFolder' On='uninstall' /> </Component> <Directory Id='TARGETDIR' Name='SourceDir'> <Component Id='TestWebVirtualDirComponent' Guid='12345678-6304-410E-A808-E3585379EADB'> <CreateFolder /> <iis:WebVirtualDir Id='TestWebVirtualDir' Alias='[WEBSITE_VIRTUALDIR]' Directory='TARGETDIR' WebSite='MyWebsite'> <iis:WebApplication Id='TestWebApplication' Name='Test' /> </iis:WebVirtualDir> </Component> </Directory> <iis:WebSite Id="MyWebsite" Description="[WEBSITE_DESCRIPTION]" SiteId="*"> <iis:WebAddress Id="AllUnassigned" Port="[WEBSITE_PORT]" /> </iis:WebSite> <Feature> <ComponentRef Id='TestWebVirtualDirComponent'/> <ComponentRef Id='PropertiesToSave'/> </Feature> </Product> 
+8
iis iis-7 wix
source share
2 answers

The WiX IIsExtension recognizes WebSite by the description of the attribute and port attribute of the WebAddress child . Thus, when you install the application, you set WEBSITE_DESCRIPTION and WEBSITE_PORT in some way. However, when the deletion starts, the specified properties are not set, and you get the behavior you described.

The solution to this is to save the necessary property values ​​in the registry and use the RegistrySearch element to read the values ​​and set the corresponding properties. This is called the "Remember Property" template and is perfectly explained by Rob Menschig here .

+5
source share

You also need to write in the registry also the [VIRTUALDIR] and [STSWEBALIAS] properties
as well as [WEBSITE_DESCRIPTION] and [WEBSITE_PORT].
Here is a complete solution that worked for me and my team:

 <Property Id='WEBSITE_DESCRIPTION' Value='Default Web Site'> <RegistrySearch Id='RememberPropertyWEBSITE_DESCRIPTION' Root='HKLM' Key='SOFTWARE\Company\Product' Name='InstalledWebsiteDescription' Type='raw' /> </Property> <Property Id='WEBSITE_PORT' Value='90'> <RegistrySearch Id='RememberPropertyWEBSITE_PORT' Root='HKLM' Key='SOFTWARE\Company\Product' Name='InstalledWebsitePort' Type='raw' /> </Property> <Property Id='VIRTUALDIR'> <RegistrySearch Id='RememberPropertyWEBSITE_VIRT' Root='HKLM' Key='SOFTWARE\Company\Product' Name='InstalledWebsiteVirtDir' Type='raw' /> </Property> <Property Id='STSWEBALIAS'> <RegistrySearch Id='RememberPropertyWEBSITE_STS' Root='HKLM' Key='SOFTWARE\Company\Product' Name='InstalledWebsiteSts' Type='raw' /> </Property> <DirectoryRef Id="TARGETDIR"> <Component Id='PropertiesToSave' Guid='{384F2559-E7CF-40D2-A2D3-347DBFD15711}'> <RegistryValue Root='HKLM' Key='SOFTWARE\Company\Product' Name='InstalledWebsiteDescription' Value='[WEBSITE_DESCRIPTION]' Type='string' /> <RegistryValue Root='HKLM' Key='SOFTWARE\Company\Product' Name='InstalledWebsitePort' Value='[WEBSITE_PORT]' Type='string' /> <RegistryValue Root='HKLM' Key='SOFTWARE\Company\Product' Name='InstalledWebsiteVirtDir' Value='[VIRTUALDIR]' Type='string' /> <RegistryValue Root='HKLM' Key='SOFTWARE\Company\Product' Name='InstalledWebsiteSts' Value='[STSWEBALIAS]' Type='string' /> </Component> </DirectoryRef> <Feature Id="Saves"> <ComponentRef Id='PropertiesToSave'/> </Feature> 
0
source share

Source: https://habr.com/ru/post/651213/


All Articles