安装到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>
我有一个自定义操作来注册ASP.NET与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?>
问题
这几乎可行.此时有两个问题:
> IIS扩展不遵守IIS-6上的托管运行时版本,因此应用程序没有设置ASP.NET版本.
>如果我使用aspnet_regiis.exe -s APP_PATH在创建后注册它,它会覆盖通配符映射(我不知道我可以运行的命令行来恢复它).
鉴于上述缺点,如何在已安装ASP.NET 2的情况下使用WIX将ASP.NET MVC 3应用程序安装到具有适当通配符映射的IIS-6上?
最佳答案 事实证明,这对我来说是一个愚蠢的错误.当我没有包含的部分(自定义操作和属性定义)正确时,上述内容足以使ASP.NET v4应用程序正常工作.
在我的情况下,我不小心引用了aspnet_isapi.dll的路径,因此它实际上没有被正确拾取.
The IIS extension doesn’t respect the managed runtime version on IIS-6, so the application doesn’t have an ASP.NET version set.
这是部分正确的.虽然在设置应用程序池时它不使用托管运行时版本,但只要某些内容正确映射到aspnet_isapi.dll,IIS就会实际获取ASP.NET版本.一旦我修好了路径,一切都正常.
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).
如果需要,您可以使用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属性.