如何使用 WIX 在 IIS 6 上安装 ASP.NET MVC 3 应用程序?

发布于 2024-12-23 16:26:28 字数 2793 浏览 5 评论 0原文

以下是安装到 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 上?

Here's some considerations when installing onto IIS-6:

  • Needs to register ASP.NET 4 (likely using aspnet_regiis.exe)
  • Needs to allow for both ASP.NET v2 and v4
  • Needs to register aspnet_isapi.dll with support for wildcard mapping

And here's what I have so far:

<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>

And I have a custom action to register ASP.NET with IIS:

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

The Problem

This almost works. There are two problems at this point:

  1. The IIS extension doesn't respect the managed runtime version on IIS-6, so the application doesn't have an ASP.NET version set.
  2. If I use aspnet_regiis.exe -s APP_PATH to register it once it's created, it overwrites the wildcard mapping (and I don't know a commandline that I can run to restore it).

Given the above shortcomings, how can I use WIX to install an ASP.NET MVC 3 application onto IIS-6 with a proper wildcard mapping when it already has ASP.NET 2 installed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月流歌 2024-12-30 16:26:28

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

就我而言,我不小心引用了 aspnet_isapi.dll 的路径,因此实际上并未正确获取它。

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

这部分是正确的。尽管在设置应用程序池时不使用托管运行时版本,但只要某些内容正确映射到 aspnet_isapi.dll。一旦我修复了路径,一切就正常了。

如果我在创建后使用 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 命令,您可以设置 <根据需要使用 code>ScriptMaps 属性。

It turns out this was a dumb error on my part. The above is sufficient to make ASP.NET v4 applications work when the pieces that I didn't include (custom actions and property definitions) are correct.

In my case, I had accidentally quoted the path to the aspnet_isapi.dll, so it wasn't actually being picked up correctly.

The IIS extension doesn't respect the managed runtime version on IIS-6, so the application doesn't have an ASP.NET version set.

That's partially true. Although it doesn't use the managed runtime version when setting the App Pool, IIS actually picks up the ASP.NET version as soon as something is correctly mapped to the aspnet_isapi.dll. As soon as I fixed the path, everything worked correctly.

If I use aspnet_regiis.exe -s APP_PATH to register it once it's created, it overwrites the wildcard mapping (and I don't know a commandline that I can run to restore it).

You can use adsutil.vbs in order to manage this if need be:

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"

By using the set command in adsutil.vbs you can set the ScriptMaps property as needed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文