1. The Issue
The MSDN documentation ( ASP.NET IIS Registration Tool ) states the following about installing .NET Framework 4 together with IIS 7.5:
The .NET Framework 4 can be installed side-by-side with previous versions of the .NET Framework on a single computer. If IIS was previously enabled on the computer, the setup process for the .NET Framework automatically registers ASP.NET 4 with IIS. However, if you install the .NET Framework 4 before you enable IIS, you must run the ASP.NET IIS Registration tool in order to register the .NET Framework with IIS and create application pools that use the .NET Framework 4.
What this means is that if you install .NET Framework 4 after installing IIS then everything gets registered properly. However, if you install .NET Framework 4 before installing IIS then you need to perform an extra step as outlined below.
2. The Solution
Run the following command from an administrative command prompt:
aspnet_regiis.exe -iru -enable
-iru Install this version of ASP.NET. If there are any existing applications that use ASP.NET, it will not change IIS configuration to use this version.
-enable ASP.NET will be enabled in the IIS security console (IIS 6.0 or later).
3. Some Notes
- You must ensure that the aspnet_regiis.exe file that is included in the .NET Framework 4 installation directory is used. The location of this file is as follows:
|Version of .NET Framework||Location of Aspnet_regiis.exe file|
|.NET Framework version 4 (32-bit systems)||%windir%\Microsoft.NET\Framework\v4.0.30319|
|.NET Framework version 4 (64-bit systems)||%windir%\Microsoft.NET\Framework64\v4.0.30319|
- The 64-bit version should be used for Windows Server 2008 R2.
- From the readme file:
ASP.NET 4 must be re-registered if IIS 7.5 or the IIS 7.5 .NET Extensibility feature is enabled *after* the .NET Framework 4 has already been installed on the computer. ASP.NET 4 must also be re-registered if the .NET Extensibility feature is removed when the .NET Framework 4 is installed on the computer.
The following diagram shows the default application pools within IIS 7.5 on Windows Server 2008 R2. In this case, .NET Framework 3.5 SP1 has been installed (supplied with the operating system). Note that this is registered as .NET Framework 2.0.
The next diagram shows the default application pools within IIS 7.5 on Windows Server 2008 R2 after .NET Framework 4 has been installed.
(Note: 20110926 – I decided to extend this article and include screenshots for when IIS 7.5 is installed on top of a Windows 2008 R2 Server that already has .NET Framework 4)