IIS 7, HttpHandler and HTTP Error 500.21

In IIS 7, I am trying to use a custom HttpHandler for my ASP.NET web application. I use the "classic" pipeline mode, version .NET 4.0.30319, my web.config configuration for the handler:

<system.webServer> <handlers> <add name="MyHandler" path="*.myExtension" verb="*" type="Company.App.UI.Controls.MyHandler, Company.App.UI" resourceType="Unspecified" /> </handlers> </system.webServer> 

When I call this handler, I get this error:

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

I did a Google search, most people fixed this problem by re-registering ASP.NET with the aspnet_regiis.exe / i command, but this is not for me (the command completes, I restart IIS, but the same error). I tried this on two different servers, but got the same result.

What else should I try? Thanks you

+13
Aug 22 2018-12-12T00:
source share
6 answers

Cannot configure managed IIS handler to run in classic mode. You must run IIS in integrated mode if you want to do this.

You can learn more about IIS modules, handlers, and modes in the following blog post:

IIS 7.0, ASP.NET, pipelines, modules, handlers, and prerequisites

For handlers, if you set preCondition = "integMode" to display, the handler will only work in integrated mode. On the other hand, if you set preCondition = "classicMode", the handler will only work in classic mode. And if you omit both of them, the handler can work in both modes, although this is not possible for the managed handler .

+13
Aug 22 2018-12-12T00:
source

Fortunately, it is very easy to solve. Run the following command from an elevated command prompt:

 %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i 

If you are using a 32-bit machine, you may need the following:

 %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i 
+7
Jul 14 '16 at 14:26
source

I had the same problem and decided to start it by running the following command

% windir% \ Microsoft.NET \ Framework64 \ v4.0.30319 \ aspnet_regiis.exe -i

+7
Dec 01 '16 at 15:22
source

I had the same problem and I just solved it. I wrote my own question about stackoverflow:

Unable to execute PUT for my IHttpHandler, GET works fine

The solution was to set runManagedModulesForWebDavRequests to true in the modules element. I assume that after installing WebDAV, all PUT requests are associated with it. If you need PUT to go to your handler, you need to remove the WebDAV module and set this attribute to true.

 <modules runManagedModulesForWebDavRequests="true"> ... </modules> 

So, if you encounter a problem when using the verb PUT, and you installed WebDAV, then I hope this solution will fix your problem.

+1
Oct 22 '15 at 9:06 on
source

One of the solutions that I found is that you will need to change the .Net Framework to v2.0 by right-clicking on the site on which you have the manager in the application pools from the access settings.

-one
Jun 17 '14 at 12:44 on
source

On a Windows 2016 server, I used:

dism /online /enable-feature /featurename:IIS-ASPNET45 /all

You can also do it through Powershell:

Install-WindowsFeature .NET-Framework-45-Features

-one
Oct 10 '17 at 10:58 on
source



All Articles