Windows Installer does not uninstall Web Applications RRS feed

  • Question

  • User124502534 posted
    I have a Windows Installer project in Visual Studio 2008 (Version 9) that installs 2 web applications.

    But when I uninstall the program, the web applications are still visible in IIS7 Manager. But their physical path points to a now non-existent directory. 

    I can manually remove the applications, but shouldn't the uninstall do it automatically?

    But this is more than a nuisance - if I change the TARGETVDIR on the next iteration of the install project, the next install still uses the TARGETVDIR of the previous install. So it is important that the web application be removed first.
    Friday, April 3, 2009 10:39 AM

All replies

  • User372121194 posted


    From your description, when you try to uninstall web application, the virtual directory is not deleted from IIS website node list, right?

    If so, you can refer to the same discussion on http://forums.asp.net/t/1397807.aspx. You can delete it from Custom Action.

    If you are using IIS 7.0 and .Net Framework 3.5, you can use Microsoft.Web.Administration which is a new a management API for the web server that enables editing configuration through complete manipulation of the XML configuration files.

    For more information, see http://msdn.microsoft.com/en-us/library/microsoft.web.administration.servermanager.aspx and http://learn.iis.net/page.aspx/165/how-to-use-microsoftwebadministration/


    I look forward to receiving your test results.

    Wednesday, April 8, 2009 5:15 AM
  • User124502534 posted

    This is incredible!

     (1) since WIndows Installer installed the Web Application (virtual directory), Windows Installer should uninstall it

    (2) Microsoft is expecting me to manipulate a config file that they invented to support web services (instead of providing a simple API that perfoms the same function as manually removing the Web Application)

    (3) the documentation for Microsoft.Web.Administration is typical Microsoft - technically correct but rarely useful.

    (4) I assume I am to remove all instances and references to my Web Application from the applicationHost.config file. Including the section that is marked "The <customMetadata> section is used internally by the Admin Base Objects (ABO) Compatibility component. Please do not modify its content.". Am I correct?

    That being said, I still don't know how to do it.

    For example, in the <customMetadata> section that are a number of <key>s that contain references to my virtual directory. So I figure I should open this section and remove my <key>s.

    But the following code:

                using (ServerManager mgr = new ServerManager())
                     Configuration appconfig = mgr.GetApplicationHostConfiguration();
                     ConfigurationSection section = appconfig.GetSection("system.applicationHost/customMetadata");                


    returns a section that has no ChildElements. So how do I enumerate the <key>s?

    Sorry for the ranting, but I am astonished at what Microsoft expects me to do.

    And I will appreciate any further assistance you can provide. Thanks.


    Thursday, April 9, 2009 11:36 AM
  • User-401347283 posted

    I also find this really annoying. I've just discovered I will have to change 10 installers for my ASP.NET sites/web services beacuse Windows Installer is not smart enough to remove the virtual directory. Isn't there any simpler way to force the installer to remove them other than custom actions? 

    Wednesday, July 15, 2009 2:39 PM