开发者

WIX 3.6 IIS 7 installer causing 'Site 1 has no root application defined, so the site will be ignored.' error on uninstall

开发者 https://www.devze.com 2023-04-05 01:27 出处:网络
I am using Wix 3.6 to install a Web application to IIS 7 and the install works correctly but when uninstalling the application either with Add/Remove Programs or with MSIExec I get the following error

I am using Wix 3.6 to install a Web application to IIS 7 and the install works correctly but when uninstalling the application either with Add/Remove Programs or with MSIExec I get the following error in IIS.

There was an error while performing this operation. Details: The application '/' does not exist.

The error in System log is as follows.

Site 1 has no root application defined, so the site will be ignored.

The log file on uninstall when using MSIExec and the /qb option shows just this one error and it doesnt seem like it could cause this type of problem where the Default Web Site directory in IIS becomes corrupt but perhaps it can.

Action start 7:04:40: ExitDialog. DEBUG: Error 2726: Action not found: ExitDialog The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2726. The arguments are: ExitDialog, , Action ended 7:04:40: ExitDialog. Return value 0. Action ended 7:04:40: INSTALL. Return value 1.

Here is the relevant portion of the wix file. If anyone has any ideas t开发者_开发知识库hat can point me in the right direction they will be greatly appreciated. Thanks in advance.

<Product
      Name="$(var.WebName)"
      Id="*"
      UpgradeCode="GUID"
      Manufacturer="MyCo"
      Version="$(var.ProductVersion)"
      Language="1033">
    <Package Id='*'
      InstallScope="perMachine"
          Manufacturer="MyCo"
          InstallerVersion="200"
          Languages="1033"
          Compressed="yes"/>

    <MajorUpgrade Schedule="afterInstallValidate"
      DowngradeErrorMessage='A later version of this application is already installed. Setup will now exit'></MajorUpgrade>

    <Media Id="1" Cabinet="MyProduct.cab" EmbedCab="yes" />

    <Property Id="IISROOT">
      <RegistrySearch Id="WEBROOT" Root="HKLM" Key="Software\Microsoft\InetStp" Name="PathWWWRoot" Type="raw" />
    </Property>
    <Property Id="WIXUI_INSTALLDIR" Value="FILEINSTALLDIR" Secure="yes" >
      <RegistrySearch Id="WIXUI_INSTALLDIR" Type="raw" Root="HKLM" Key="SOFTWARE\MyCo" Name="InstallDir" />
    </Property>
    <Property Id="WIXUI_VIRTUALDIR" Secure="yes" Value="VIRTUALDIR" >
      <RegistrySearch Id="WIXUI_VIRTUALDIR" Type="raw" Root="HKLM" Key="SOFTWARE\MyCo" Name="WixUiVirtualDir" />
    </Property>
    <Property Id="VIRTUALDIR" Secure="yes" Hidden="no" >
      <RegistrySearch Id="VIRTUALDIR" Type="raw" Root="HKLM" Key="SOFTWARE\MyCo" Name="VirtualDir" />
    </Property>
    <CustomAction Id="FILEINSTALLDIR" Property="FILEINSTALLDIR" Value="[IISROOT]\[VIRTUALDIR]" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="IISROOT" Name=".">
        <Directory Id="FILEINSTALLDIR" Name="AppDirectory">
          <Component Id="MyCo_AppComponent" Guid="GUID">
            <File Source=...
    </Component>
        </Directory>
      </Directory>
    </Directory>

    <iis:WebSite Id="DefaultWebSite" Description="Default Web Site" SiteId="*">
      <iis:WebAddress Id="AllUnassigned" Port="1" />
    </iis:WebSite>

    <DirectoryRef Id="FILEINSTALLDIR">
      <Component Id="MyCoSiteComponent" Guid="GUID" KeyPath="yes">
        <iis:WebVirtualDir Id='AppComponentVirtDir' Alias='[VIRTUALDIR]' Directory='FILEINSTALLDIR'
                         WebSite='DefaultWebSite'>
          <iis:WebDirProperties Id="AppComponentVirtDirProperties"
                       AnonymousAccess="no" BasicAuthentication="no"
                       WindowsAuthentication="yes" />
          <iis:WebApplication Id='MyAppName' Name='[VIRTUALDIR]' Isolation='medium' />
        </iis:WebVirtualDir>
      </Component>        
    </DirectoryRef>


I figured out what I was doing wrong, there was a registry setting that was named differently in the lookup then it was in the removal, since I didn't include that in the original code I will include the bad code example below. Note the Registry path is different 1) MyCo 2) MyCompany (this is for demonstration purposes but you get my drift). This caused the Default Web Site to become corrupt and had to be replaced. So in short make sure the Registry key names you make are named correctly! :) This was a painful one.

Where I set the value from the Registry:

<Property Id="WIXUI_VIRTUALDIR" Secure="yes" Value="VIRTUALDIR" >
  <RegistrySearch Id="WIXUI_VIRTUALDIR" Type="raw" Root="HKLM" Key="SOFTWARE\MyCo" Name="WixUiVirtualDir" />
</Property>

Where I remove the Registry setting:

<DirectoryRef Id="FILEINSTALLDIR">
  <Component Id="RegistryEntries" Guid="GUID">
    <RegistryKey Root="HKLM"
                 Key="SOFTWARE\MyCompany"
          Action="createAndRemoveOnUninstall">
      <RegistryValue Type="string" Name="WixUiVirtualDir" Value="[VIRTUALDIR]" />
    </RegistryKey>
  </Component>
</DirectoryRef>
0

精彩评论

暂无评论...
验证码 换一张
取 消