Reputation: 1597
i'm installing a WebApplication in IIS. Installation is running OK, but when i try to uninstall my product, the WebApplication is left behind in IIS. All files are removed, but the WebApp still shows up in IIS manager console. This is my component code:
<!-- WebServices Virtual Directory -->
<Component Id="IWSVirtualDirectory" Guid="{XXXX...}" DiskId="1" KeyPath="yes" Win64="no">
<!-- Virtual directory -->
<iis:WebVirtualDir Id="IWSWebVirtualDirectory" Alias="[IWS_VIRTUAL_DIRECTORY_NAME]" Directory="MyWebServices" WebSite="IWSTargetWebSite">
<!-- Web Application -->
<iis:WebApplication Id="IWSWebApplication" Name="MyWebServices-$(var.MAJOR).$(var.MINOR).3" WebAppPool="IWSWebAppPool">
<!-- ISAPI filter -->
<iis:WebApplicationExtension Extension="dll" CheckPath="yes" Script="yes" Executable="[#FTIRWWSIsapi_dll]" Verbs="GET,HEAD,POST" />
<iis:WebApplicationExtension Extension="srf" CheckPath="yes" Script="yes" Executable="[#FTIRWWSIsapi_dll]" Verbs="GET,HEAD" />
</iis:WebApplication>
<!-- Properties -->
<iis:WebDirProperties Id="IWSWebDirProperties" Read="yes" LogVisits="yes" Index="yes" Script="yes" Execute="no" DefaultDocuments="FTIRWWS.htm" BasicAuthentication="no" PassportAuthentication="no" DigestAuthentication="no" IIsControlledPassword="no" WindowsAuthentication="yes" />
</iis:WebVirtualDir>
</Component>
Edit:
Oddly, the WebApplication is actually removed if i delete the two <iis:WebApplicationExtension />
those are just mapping handlers to file extensions to be served by the application. Why would the handler mappings prevent the WebApplication from being uninstalled?? Are there any logs to check what's going on apart from Windows Installer logs?
Upvotes: 1
Views: 701
Reputation: 32240
The property you use for defining the virtual directory alias (application name) is not set properly on uninstall. When you run the installation, you probably set the IWS_VIRTUAL_DIRECTORY_NAME
somehow (asking the user, some logic, etc.) But on uninstall this property doesn't get set, and WiX can't find the virtual directory to remove on uninstall.
This is a common mistake people tend to make. You have to store the value of IWS_VIRTUAL_DIRECTORY_NAME
somehow. The best known approach is described by Rob Mensching and is called "Remember the property" pattern. Follow the suggestion in that article, and you'll be able to store the properties in between install and uninstall.
Upvotes: 1