ASP.NET IIS 7.5 HTTP 500.21 error

21

I am having an issue setting up a local site.

The project is using ASP.NET Framework 4.0 and I have my DefaultAppPool to use 4.0 with Managed Pipeline Mode as Integrated.

This is the error I get:

HTTP Error 500.21 - Internal Server Error
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

Module  IIS Web Core
Notification    ExecuteRequestHandler
Handler PageHandlerFactory-Integrated
Error Code  0x8007000d
Requested URL   http://localhost:80/default.aspx
Physical Path   C:\Snugabye\Website\default.aspx
Logon Method    Anonymous
Logon User  Anonymous

Most likely causes:
Managed handler is used; however, ASP.NET is not installed or is not installed completely.
There is a typographical error in the configuration for the handler module list.

Things you can try:
Install ASP.NET if you are using managed handler.
Ensure that the handler module's name is specified correctly. Module names are case-sensitive and use the format modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule".

Under Control Panel -> Programs -> Turn Window features on / off all I see is Microsoft .NET Framework 3.5.1 and nothing regarding 4.0 is there something I am missing?

asp.net
iis
asked on Stack Overflow Apr 9, 2014 by user1269625 • edited May 19, 2016 by halfer

4 Answers

50

Did you register .NET with IIS? If not run the following commands:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

You need to do this from an elevated command prompt (...run as admin).

answered on Stack Overflow Sep 24, 2014 by diegosasw • edited Dec 29, 2014 by secretwep
4

I am guessing that based on your .NET version that you're on Windows 7.

According to .NET 4.0 Versions and Dependencies:

(.NET 4.0) Not installed as part of the Windows operating system, but can be installed separately on Windows XP, Windows Server 2003, and later versions of Windows.

Follow this link for an installer of .NET 4.0

After installing you may have to do additional config. See this blog post.

Excerpts from the blog post in case of link loss:

After installing .NET Framework 4.0 on a machine there is a few configuration changes you need to do to IIS in order to get a ASP.NET 4.0 page running:

First set the Application pool to run in ASP.NET v4.0 “mode”.

Then you need to allow ASP.NET v4.0.x to run. This is done in the ISAPI and CGI Restrictions found on the server level.

(Go to Administrative Tools > Internet Info Services Manager > Click on the Server. Then Open ISAPI and CGI Restrictions > Find ASP.NET V4.0.XXX make sure the restriction is set to Allowed. If set to Not Allowed, double click it, and check the Allow extension path to execute. Hit OK.)

Note: Depending on order of installation you may also have to run aspnet_regiis.exe -i from the command line to "re-install" ASP.NET on IIS.

Instructions for configuring ISAPI and CGI restrictions for IIS 7.5 on various Windows flavors.

answered on Stack Overflow Apr 9, 2014 by Paul Sasik • edited Apr 9, 2014 by Paul Sasik
4

I was facing the same issue. When i checked at App pool.NET framework version it was v2.0. My application was with 4.0 compatible. I ran below commands which has fixed the issue and now I am able to get my web services

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

However after running those commands the default .NET framwork also changed to v4.0

answered on Stack Overflow Nov 11, 2015 by Dipak Patil • edited Apr 5, 2018 by Shree
0

You must register IIS to framework 4 to execute it correctly. You must follow the start menu as given below to get VS(installed version) command prompt Start->All Programs -> Microsoft Visual Studio (installed version)->Visual Studio Tools -> Visual Studio Command Prompt(installed version)

For details try below link : https://forums.asp.net/t/1587832.aspx?Problem+with+ExecuteRequestHandler+in+iis7

answered on Stack Overflow Apr 5, 2018 by Alireza Yaghoubi • edited Oct 8, 2018 by Roman Pokrovskij

User contributions licensed under CC BY-SA 3.0