Domanda

Sto creando un programma di installazione per un sito Web ASP.Net utilizzando WiX. Come si imposta la versione ASP.Net in IIS utilizzando WiX?

È stato utile?

Soluzione

Usiamo questo:

Per prima cosa determinare la directory principale del framework .Net dal registro:

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

Quindi, all'interno del componente che installa il tuo sito Web in 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>

Per un programma di installazione x64 ( QUESTO È IMPORTANTE ) Aggiungi Win64 = 'yes' alla ricerca nel registro, perché l'ambiente a 32 bit su una macchina a 64 bit ha un alveare di registro diverso (e un frameworkroot diverso)

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

Altri suggerimenti

Ecco cosa ha funzionato per me dopo aver lottato con esso:

  <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] e [VIRTUALDIR] sono proprietà che devi definirti. [VIRTUALDIR] è necessario solo se si sta impostando la versione ASP.NET per un'applicazione anziché per un intero sito Web.

Il sequenziamento dell'azione personalizzata è fondamentale. L'esecuzione prima di InstallFinalize non riuscirà perché l'applicazione Web non sarà disponibile fino a quel momento.

Grazie a Chris Burrows per un esempio corretto di ricerca dell'eseguibile aspnet_regiis (Google " Utilizzo di WIX per proteggere una stringa di connessione ").

jb

Non dimenticare di abilitare ASP 2.0 sul server

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

Ecco la domanda sof

La mia risposta è sostanzialmente la stessa di quella vista qui; Volevo solo offrire alla gente un altro esempio.

Dato il numero di estensioni di file che ASP.NET gestisce e che l'elenco cambia in ogni versione, penso che la soluzione più affidabile sia eseguire aspnet_regiis al termine dell'installazione. Ciò significa, tuttavia, che non ho alcun supporto per il rollback o la disinstallazione. Sto creando una nuova applicazione in IIS, non importa perché verrà eliminata da Wix. Se stai modificando un'applicazione esistente, forse potresti scoprire dal registro quale versione di ASP.NET è configurata ed eseguire il aspnet_regiis di quella versione per annullare le modifiche.

Quanto segue utilizza 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>

Questo è un po 'più semplice. Non so se questo funziona con l'aggiornamento di un AppPool esistente, ma funziona con la creazione di un pool di APP e l'impostazione della versione .NET.

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

Ho trovato un modo diverso utilizzando WiX WebApplicationExtension. Puoi consultare la soluzione completa qui e qui .

Mi piace Wix finora, ma l'uomo ci vuole molto a scavare per trovare quello che stai cercando.

  • Per prima cosa trova la cartella della versione .NET corretta. Utilizzare DirectorySearch / FileSearch per eseguire la ricerca.

  • Utilizza il percorso precedente per chiamare aspnet_regiis.exe e impostare la versione per la webapp da un'azione personalizzata.

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top