【问题标题】:How do I install an ASP.NET MVC 3 application on IIS 6 using WIX?如何使用 WIX 在 IIS 6 上安装 ASP.NET MVC 3 应用程序?
【发布时间】:2012-01-02 15:34:46
【问题描述】:

以下是安装到 IIS-6 时的一些注意事项:

  • 需要注册 ASP.NET 4(可能使用aspnet_regiis.exe
  • 需要同时支持 ASP.NET v2 和 v4
  • 需要注册aspnet_isapi.dll以支持通配符映射

这是我目前所拥有的:

<iis:WebDirProperties Id='WebDirProperties' Script='yes' Read='yes
  Execute='no' WindowsAuthentication='yes' AnonymousAccess='no' 
  AuthenticationProviders='NTLM,Negotiate' />

<!-- SO has some good posts on selecting the website from a dropdown -->
<iis:WebSite Id='SelectedWebSite' Directory='WWWROOT' SiteId='[WEBSITE_ID]' Description='[WEBSITE_DESCRIPTION]'>
  <iis:WebAddress Id='AllUnassigned' Port='80' IP='*'/>
</iis:WebSite>

  <Component Id="ProjWebApp" Guid="{B4BE9223-7109-4943-AE4E-8F72FA350D02}" 
    Win64="$(var.IsWin64)" NeverOverwrite="yes" Transitive="yes">
    <CreateFolder/>

    <iis:WebAppPool Id="ProjAppPool" Name="[APPPOOLNAME]" Identity="networkService"
      ManagedRuntimeVersion="v4.0" ManagedPipelineMode="integrated" />
    <iis:WebVirtualDir Id="ProjVDir" DirProperties="WebDirProperties"
      Alias="[WEBAPPNAME]" Directory="WEBFILESDIR" WebSite="SelectedWebSite">
      <iis:WebApplication Id="ProjApp" Name="[WEBAPPNAME]" WebAppPool="ProjAppPool">
        <iis:WebApplicationExtension
            CheckPath="no"
            Script="yes"
            Executable="[ASPNETISAPIDLL]"
            Verbs="GET,HEAD,POST"
            />
      </iis:WebApplication>
    </iis:WebVirtualDir>
  </Component>

  <!-- other apps may start using it once installed so it must be permanent -->
  <Component Id="EnableASPNet4Extension" Permanent="yes" Guid="{C8CDAB96-5DDC-4B4C-AD7E-CD09B59F7813}">
    <iis:WebServiceExtension Id="ASPNet4Extension" Group="ASP.NET v4.0.30319"
      Allow="yes" File="[ASPNETISAPIDLL]" Description="ASP.NET v4.0.30319" 
      UIDeletable="no"
      />
  </Component>

我有一个自定义操作来向 IIS 注册 ASP.NET:

<?if $(var.Platform) = x64 ?>
  <CustomAction Id="SetProperty_AspNetRegIIS_InstallNet40Cmd"
    Property="AspNetRegIIS_InstallNet40Cmd"
    Value="&quot;[NETFRAMEWORK40FULLINSTALLROOTDIR64]aspnet_regiis.exe&quot; -ir"/>
<?else?>
  <CustomAction Id="SetProperty_AspNetRegIIS_InstallNet40Cmd"
    Property="AspNetRegIIS_InstallNet40Cmd"
    Value="&quot;[NETFRAMEWORK40FULLINSTALLROOTDIR]aspnet_regiis.exe&quot; -ir"/>
<?endif?>

问题

这几乎可行。此时有两个问题:

  1. IIS 扩展不尊重 IIS-6 上的托管运行时版本,因此应用程序没有设置 ASP.NET 版本。
  2. 如果我在创建后使用 aspnet_regiis.exe -s APP_PATH 注册它,它会覆盖通配符映射(而且我不知道可以运行什么命令行来恢复它)。

鉴于上述缺点,如果已经安装了 ASP.NET 2,如何使用 WIX 将 ASP.NET MVC 3 应用程序安装到具有正确通配符映射的 IIS-6 上?

【问题讨论】:

    标签: asp.net-mvc iis-6 wix


    【解决方案1】:

    事实证明这是我的一个愚蠢错误。当我未包含的部分(自定义操作和属性定义)正确时,以上内容足以使 ASP.NET v4 应用程序正常工作。

    在我的例子中,我不小心引用了aspnet_isapi.dll 的路径,所以它实际上并没有被正确拾取。

    IIS 扩展不尊重 IIS-6 上的托管运行时版本,因此应用程序没有设置 ASP.NET 版本。

    部分正确。尽管在设置应用程序池时它不使用托管运行时版本,但 IIS 实际上会在某些内容正确映射到 aspnet_isapi.dll 时选择 ASP.NET 版本。修好路径后,一切正常。

    如果我在创建后使用 aspnet_regiis.exe -s APP_PATH 注册它,它会覆盖通配符映射(而且我不知道可以运行什么命令行来恢复它)。

    如果需要,您可以使用adsutil.vbs 进行管理:

    C:\Inetpub\AdminScripts>adsutil.vbs enum w3svc/998577302/root/AppName
    KeyType                         : (STRING) "IIsWebVirtualDir"
    ...
    ScriptMaps                      : (LIST) (1 Items)
      "*,C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll,1,GET,HEAD
    ,POST"
    

    通过在adsutil.vbs 中使用set 命令,您可以根据需要设置ScriptMaps 属性。

    【讨论】:

      猜你喜欢
      • 2013-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-20
      • 2012-02-14
      • 1970-01-01
      • 2011-11-30
      • 2011-11-15
      相关资源
      最近更新 更多