How to install an ASP.NET MVC 3 application on IIS 6 using WIX?

Here are some considerations when installing on IIS-6:

  • You need to register ASP.NET 4 (probably using aspnet_regiis.exe )
  • You must enable both ASP.NET v2 and v4
  • You must register aspnet_isapi.dll with wildcard support

And here is what I still have:

 <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 for registering ASP.NET using IIS:

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

Problem

It almost works. There are currently two problems:

  • The IIS extension does not support the managed-run version of IIS-6, so the application does not have a set of ASP.NET versions.
  • If I use aspnet_regiis.exe -s APP_PATH to register it after it is created, it overwrites the wildcard mapping (and I don't know the command line that I can run to restore it).

Given the above drawbacks, how can I use WIX to install an ASP.NET MVC 3 application on IIS-6 with the corresponding wildcard mapping when it is already installed by ASP.NET 2?

+4
source share
1 answer

It turns out that it was a stupid mistake on my part. The above is enough for ASP.NET v4 applications to work when the parts that I did not include (user actions and property definitions) are correct.

In my case, I accidentally quoted the path to aspnet_isapi.dll , so in fact it was not correctly raised.

The IIS extension does not consider the version of the managed version of execution on IIS-6, so the application does not have a set of ASP.NET versions.

This is partly true. Despite the fact that when setting up the application pool it does not use a managed version of execution, IIS actually selects the version of ASP.NET as soon as something is correctly mapped to aspnet_isapi.dll . As soon as I corrected the path, everything worked correctly.

If I use aspnet_regiis.exe -s APP_PATH to register it after it is created, it overwrites the wildcard mapping (and I donโ€™t know the command line that I can run to restore it).

You can use adsutil.vbs to manage this if necessary:

 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" 

Using the set command in adsutil.vbs , you can set the ScriptMaps property as needed.

+2
source

Source: https://habr.com/ru/post/1388950/


All Articles