While creating an ASP.NET Website in IIS 7 in Visual Studio 2008/2010, you may get the following error:
“ASP.NET 4.0 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.0 in order for your site to run correctly, Press F1 for more details”
This error usually occurs if you have installed IIS 7.x ‘after’ installing .NET. In order to resolve the error, do the following:
Step 1: Open Control Panel > Programs > Turn Windows Features on or off > Internet Information Services > World Wide Web Services > Application development Feature
Check the box 'ASP.NET' . Also in the Web Management Tools, remember to select IIS 6 Management Compatibility and IIS Metabase as shown below.
Note: Make sure that you are running Visual Studio 2010 as Administrator.
Now run the site from Visual Studio 2010 using Ctrl + F5.
Step 2: If you further get the error “Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list” or Managed handler is used; however, ASP.NET is not installed or is not installed completely then do a Visual Studio 2010 repair.
Start > Programs > Accessories > Run. Type this command depending on the version of VS 2010 installed.
Silent Repair for 32-bit
%windir%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Client\setup.exe /repair /x86 /x64 /ia64 /parameterfolder Client /q /norestart
Silent Repair for 64-bit
%windir%\Microsoft.NET\Framework64\v4.0.30319\SetupCache\Client\setup.exe /repair /x86 /x64 /ia64 /parameterfolder Client /q /norestart
That’s it. Restart IIS and the errors should be fixed.
Step 3: If the errors are not yet fixed, there could be an issue in the Application Pool. Follow these steps
1. Open IIS Manager (Run > Inetmgr) . Expand the server node and then click Application Pools
2. Now select the application pool that contains the application that you want to change. Go to Actions > View Applications.
3. Select the Application pool to change > In Action Pane, click on ‘Change Application Pool’
4. In the ‘Select Application Pool’ dialog box, select the application pool associated with .NET 4.0 from the Application pool list and then click OK.