Pregunta

Estoy creando un instalador para un sitio web ASP.Net usando WiX. ¿Cómo se configura la versión ASP.Net en IIS usando WiX?

¿Fue útil?

Solución

Usamos esto:

Primero determine el directorio raíz de .Net framework desde el registro:

<Property Id="FRAMEWORKROOT">
  <RegistrySearch Id="FrameworkRootDir" Root="HKLM"
                Key="SOFTWARE\Microsoft\.NETFramework" 
                Type="directory" Name="InstallRoot" />
</Property>

Luego, dentro del componente que instala su sitio web en IIS:

<!-- Create and configure the virtual directory and application. -->
<Component Id='WebVirtualDirComponent' Guid='{GUID}' Permanent='no'>
  <iis:WebVirtualDir Id='WebVirtualDir' Alias='YourAlias' Directory='InstallDir' WebSite='DefaultWebSite'  DirProperties='DirProperties'>
    <iis:WebApplication Id='WebApplication' Name='YourAppName' WebAppPool='AppPool'>
      <!-- Required to run the application under the .net 2.0 framework -->
      <iis:WebApplicationExtension Extension="config" CheckPath="yes" Script="yes"
                    Executable="[FRAMEWORKROOT]v2.0.50727\aspnet_isapi.dll" Verbs="GET,HEAD,POST" />
      <iis:WebApplicationExtension Extension="resx" CheckPath="yes" Script="yes"
                    Executable="[FRAMEWORKROOT]v2.0.50727\aspnet_isapi.dll" Verbs="GET,HEAD,POST" />
      <iis:WebApplicationExtension Extension="svc" CheckPath="no" Script="yes"
                    Executable="[FRAMEWORKROOT]v2.0.50727\aspnet_isapi.dll" Verbs="GET,HEAD,POST" />
    </iis:WebApplication>
  </iis:WebVirtualDir>
</Component>

Para un instalador x64 ( ESTO ES IMPORTANTE ) Agregue Win64 = 'sí' a la búsqueda de registro, porque el entorno de 32 bits en una máquina de 64 bits tiene una sección de registro diferente (y una raíz de framework diferente)

<RegistrySearch Id="FrameworkRootDir" Root="HKLM"
        Key="SOFTWARE\Microsoft\.NETFramework" 
        Type="directory" 
        Name="InstallRoot" Win64='yes' />

Otros consejos

Esto es lo que me funcionó después de luchar con él:

  <Property Id="FRAMEWORKBASEPATH">
     <RegistrySearch Id="FindFrameworkDir" Root="HKLM" Key="SOFTWARE\Microsoft\.NETFramework" Name="InstallRoot" Type="raw"/>
  </Property>
  <Property Id="ASPNETREGIIS" >
     <DirectorySearch Path="[FRAMEWORKBASEPATH]" Depth="4" Id="FindAspNetRegIis">
        <FileSearch Name="aspnet_regiis.exe" MinVersion="2.0.5"/>
     </DirectorySearch>
  </Property>

  <CustomAction Id="MakeWepApp20" Directory="TARGETDIR" ExeCommand="[ASPNETREGIIS] -norestart -s W3SVC/[WEBSITEID]/ROOT/[VIRTUALDIR]" Return="check"/>

  <InstallExecuteSequence>
     <Custom Action="MakeWepApp20" After="InstallFinalize">ASPNETREGIIS AND NOT Installed</Custom>
  </InstallExecuteSequence>

[WEBSITEID] y [VIRTUALDIR] son ??propiedades que debe definir usted mismo. [VIRTUALDIR] solo es necesario si está configurando la versión ASP.NET para una aplicación en lugar de un sitio web completo.

La secuencia de la acción personalizada es crítica. Ejecutarlo antes de InstallFinalize hará que falle porque la aplicación web no estará disponible hasta después.

Gracias a Chris Burrows por un ejemplo adecuado de cómo encontrar el ejecutable aspnet_regiis (Google " Uso de WIX para asegurar una cadena de conexión ").

jb

No olvides habilitar ASP 2.0 en el servidor

<iis:WebServiceExtension Id="ExtensionASP2" Group="ASP.NET v2.0.50727" Allow="yes" File="[NETFRAMEWORK20INSTALLROOTDIR]aspnet_isapi.dll" Description="ASP.NET v2.0.50727"/>

Aquí está el soft-question

Mi respuesta es básicamente la misma que otras que se ven aquí; Solo quería ofrecerle a la gente otro ejemplo.

Dado el número de extensiones de archivo que maneja ASP.NET y que la lista cambia en cada versión, creo que la solución más confiable es ejecutar aspnet_regiis al final de la instalación. Sin embargo, esto significa que no tengo soporte para la reversión o desinstalación. Si está creando una nueva aplicación en IIS, realmente no importa porque Wix la eliminará. Si está modificando una aplicación existente, tal vez podría averiguar en el registro qué versión de ASP.NET está configurada y ejecutar el aspnet_regiis de esa versión para deshacer sus cambios.

Lo siguiente usa Wix 3.5.

<Fragment>
    <!-- Use the properties in Wix instead of doing your own registry search. -->
    <PropertyRef Id="IISMAJORVERSION"/>
    <PropertyRef Id="NETFRAMEWORK40FULL"/>
    <PropertyRef Id="NETFRAMEWORK40FULLINSTALLROOTDIR"/>

    <!-- The code I'm using is intended for IIS6 and above, and it needs .NET 4 to be
    installed. -->
    <Condition Message="This application requires the .NET Framework 4.0. Please install the required version of the .NET Framework, then run this installer again.">
        <![CDATA[Installed OR (NETFRAMEWORK40FULL)]]>
    </Condition>
    <Condition Message="This application requires Windows Server 2003 and Internet Information Services 6.0 or better.">
        <![CDATA[Installed OR (VersionNT >= 502)]]>
    </Condition>

    <!-- Populates the command line for CAQuietExec. IISWEBSITEID and IISVDIRNAME 
    could be set to default values, passed in by the user, or set in your installer's 
    UI. -->
    <CustomAction Id="ConfigureIis60AspNetCommand" Property="ConfigureIis60AspNet"
                  Execute="immediate"
                  Value="&quot;[NETFRAMEWORK40FULLINSTALLROOTDIR]aspnet_regiis.exe&quot; -norestart -s &quot;W3SVC/[IISWEBSITEID]/ROOT/[IISVDIRNAME]&quot;" />
    <CustomAction Id="ConfigureIis60AspNet" BinaryKey="WixCA" DllEntry="CAQuietExec" 
                  Execute="deferred" Return="check" Impersonate="no"/>
    <InstallExecuteSequence>
        <Custom Action="ConfigureIis60AspNetCommand" After="CostFinalize"/>

        <!-- Runs the aspnet_regiis command immediately after Wix configures IIS. 
        The condition shown here assumes you have a selectable feature in your 
        installer with the ID "WebAppFeature" that contains your web components. The 
        command will not be run if that feature is not being installed, or if IIS is 
        not version 6. It *will* run if the application is being repaired. 

        SKIPCONFIGUREIIS is a property defined by Wix that causes it to skip the IIS
        configuration. -->
        <Custom Action="ConfigureIis60AspNet" After="ConfigureIIs" Overridable="yes">
            <![CDATA[((&WebAppFeature = 3) OR (REINSTALL AND (!WebAppFeature = 3))) 
            AND (NOT SKIPCONFIGUREIIS) AND (IISMAJORVERSION = "#6")]]>
        </Custom>
    </InstallExecuteSequence>
    <UI>
        <ProgressText Action="ConfigureIis60AspNetCommand"
            >Configuring ASP.NET</ProgressText>
        <ProgressText Action="ConfigureIis60AspNet"
            >Configuring ASP.NET</ProgressText>
    </UI>

</Fragment>

Esto es un poco más simple. No sé si esto funciona para actualizar un AppPool existente, pero funciona para crear un grupo de aplicaciones y configurar la versión .NET.

<iis:WebServiceExtension Id="AMS_AppPool" Name="AccountManagementSVC1" Identity="other"  ManagedPipelineMode="integrated" ManagedRuntimeVersion="v4.0" User="AMS_AppPoolUser" RecycleMinutes="120" />

Encontré una forma diferente usando la extensión de aplicación web WiX. Puede consultar la solución completa aquí y aquí .

Me gusta Wix hasta ahora, pero el hombre necesita mucho trabajo de excavación para encontrar lo que estás buscando.

  • Primero encuentre la carpeta correcta de la versión .NET. Utilice DirectorySearch / FileSearch para realizar la búsqueda.

  • Use la ruta anterior para llamar a aspnet_regiis.exe y configure la versión para la aplicación web desde una acción personalizada.

    aspnet_regiis.exe -s W3SVC / 1 / ROOT / SampleApp1

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top