A current project has a custom MSI installer created using Wix 3.5. The installer will completely configure a new Web Site and Web Application, setting all the basic properties you’d expect on Windows Server 2003 SP3 running IIS 6.0. The install completes without error, after setting customized permissions the site can be accessed successfully. The problem comes in after the uninstall process. The uninstall does not totally remove the IIS Web Site or Web Application from IIS or the related COM+ Applications. To prevent changes to the MSI until next release, a manual delete of the directory and IIS Web Site is performed. COM+ Applications can be intimidating to someone who is not familiar with them. Lets face it, most developers and administrator rarely deal with COM+ Services. That said, the goal is to be able to provide a hands free programmatic solution to remove the COM+ Applications residue.
Problem:
Custom MSI created using Wix 3.5 to install a Web Site and Virtual directory hosting a ASP.NET 3.5 web application is NOT removing the COM+ applications created.
COM+ Applications:
IIS-{My Web Site//Root}
IIS-{My Web Site//Root/MyWebApp}
Solution:
There are three solutions, (1) manually remove them using COM+ Services or (2) programmatically remove them using script of choice or (3) look into why Wix is not removing the COM+ applications. It is important to note, by default COM+ Applications are protected from deletion. To perform a delete of a COM+ Application one must first ensure the Protect setting, “Deleteable” is unchecked to permit deletion. Otherwise any delete action will be denied.
Manual Deletion:
Open COM+ Services, Start –> Administrator Tools –> Component Services
Select COM+ Application for deletion to set the Protection level ( “Deleteable” ). In our case, it is “IIS-{My Web Site//Root}” and “IIS-{My Web Site//Root/MyWebApp}”
Right Click and select Properties
Select Advanced tab
In the “Protection” section un-check the “Disable deletion”
Click Apply and Ok
Select COM+ Application for deletion that you just set the Protection level to allow deletes
Press Delete button
Confirm Delete
Refresh Component Services ( in some cases you might need to close Component Services and re-Open )
Programmatically Delete:
The gist is to get a collection of COM+ applications based on the COM+ application names you want to delete and set the Protection “Deleteable” attribute to true. This allows the script to later perform the delete otherwise the delete will be ignored. Then loop through the collection, again looking for COM+ application names you want to delete, if there is a match, check the “Deteleable” attribute is enabled ( true ) then perform the remove from the collection and SaveChanges. Finally the script loops through the COM+ Application collection to ensure there are NO missed applications set for deletion.
** Note the code sample below is in VBScript ( .vbs ). In the future I would like to convert this to a PowerShell script.
** I must give credit for the basis of the script to this post.
Research Wix Installation/Uninstallation of COM+ Applications: