25

WiX を使用して ASP.Net Web サイトのインストーラーを作成しています。WiX を使用して IIS で ASP.Net のバージョンを設定するにはどうすればよいですか?

4

7 に答える 7

22

これを使用します:

まず、レジストリから .Net フレームワークのルート ディレクトリを特定します。

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

次に、Web サイトを 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>

x64 インストーラーの場合 (これは重要です)、レジストリ検索に Win64='yes' を追加します。これは、64 ビット マシン上の 32 ビット環境には異なるレジストリ ハイブ (および異なるフレームワーク ルート) があるためです。

<RegistrySearch Id="FrameworkRootDir" Root="HKLM"
        Key="SOFTWARE\Microsoft\.NETFramework" 
        Type="directory" 
        Name="InstallRoot" Win64='yes' />
于 2008-10-14T08:57:18.240 に答える
13

それと格闘した後、私のために働いたのは次のとおりです。

  <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] と [VIRTUALDIR] は、自分で定義する必要があるプロパティです。[VIRTUALDIR] は、Web サイト全体ではなくアプリケーションの ASP.NET バージョンを設定する場合にのみ必要です。

カスタム アクションの順序付けは重要です。InstallFinalize の前に実行すると、Web アプリケーションはその後まで使用できないため、失敗します。

aspnet_regiis 実行可能ファイルを見つける適切な例を提供してくれた Chris Burrows に感謝します (Google "Using WIX to Secure a Connection String")。

JB

于 2009-05-28T22:26:49.023 に答える
5

サーバーで ASP 2.0 を有効にすることを忘れないでください。

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

これがソフ質問です

于 2009-09-03T15:07:28.620 に答える
4

私の答えは基本的にここで見られる他のものと同じです。人々に別の例を提供したかっただけです。

ASP.NET が処理するファイル拡張子の数と、バージョンごとにリストが変わることを考えると、最も信頼できる解決策はaspnet_regiis、インストールの最後に実行することだと思います。ただし、これは、ロールバックまたはアンインストールをサポートしていないことを意味します。IIS で新しいアプリケーションを作成していますが、Wix によって削除されるため、特に問題はありません。既存のアプリケーションを変更している場合、レジストリから構成されている ASP.NET のバージョンを確認し、そのバージョンを実行しaspnet_regiisて変更を元に戻すことができます。

以下は 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>
于 2012-03-12T10:49:03.233 に答える
1

これは少し簡単です。これが既存のAppPoolの更新で機能するかどうかはわかりませんが、APPプールの作成と.NETバージョンの設定では機能します。

<iis:WebServiceExtension Id="AMS_AppPool" Name="AccountManagementSVC1" Identity="other"  ManagedPipelineMode="integrated" ManagedRuntimeVersion="v4.0" User="AMS_AppPoolUser" RecycleMinutes="120" />
于 2012-05-16T23:48:51.013 に答える
1

WiX WebApplicationExtension を使用して別の方法を見つけました。ここここで完全なソリューションを確認できます。

私はこれまでのところ Wix が好きですが、探しているものを見つけるには多くの掘り下げが必要です。

于 2008-10-02T20:56:31.907 に答える
0
  • まず、正しい .NET バージョンのフォルダーを見つけます。DirectorySearch/FileSearch を使用して検索を実行します。

  • 上記のパスを使用して aspnet_regiis.exe を呼び出し、カスタム アクションから webapp のバージョンを設定します。

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

于 2008-10-02T17:58:43.457 に答える