質問

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

役に立ちましたか?

解決

これを使用します:

最初に、レジストリから.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インストーラーの場合(これは重要です) 64ビットマシンの32ビット環境には異なるレジストリハイブ(および異なるframeworkroot)があるため、レジストリ検索にWin64 = 'yes'を追加します

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

他のヒント

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

  <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&quot; WIXを使用して接続文字列を保護する&quot;)。

jb

サーバーで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"/>

sof-question

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

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>

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

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

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

私はこれまでWixが好きですが、男はあなたが探しているものを見つけるのに多くの掘り出しが必要です。

  • 最初に正しい.NETバージョンのフォルダーを見つけます。 DirectorySearch / FileSearchを使用して検索を実行します。

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

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top