[c#] Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

To be honest, I've tried to turn a dirty trick on IIS and just when I thought that I was going to get away with it, I realized my workaround doesn't work. Here's what I've tried to do:

1) I have ASP.NET application which has Preloader class that inherits IProcessHostPreloadClient and does all the heavy initialization in Preload method implementation (application is complex and it's a part of an enormous system, so it requires approximately 2 minutes to establish connections to all necessary services and pre-instantiate some Unity registrations).

2) I have a lot of work that needs to be done on application shutdown (unsubscribing, disconnecting, disposing,...), and I guess the best place to do it is in *Application_End* method located in Global.asax.

3) Everything works just fine when I have user activity (first request after the Application Pool that contains aforementioned web application is started will cause *Application_Start* to be called and afterwards *Application_End* is called on Application Pool stop or recycle), but problems occur when there is no user activity and application tries to restart itself after being active for 48 hours (configured requirement). Since there was no requests, application officially didn't get started. Ergo, it can't be gracefully stopped since *Application_End* won't be called.

4) Now comes the messy part... I've tried to make a GET request from code at the end of the Preload method, and it worked. But this solution seemed bad to me, even though it worked. So, I've tried a lot of things, and the last thing I tried was this:

SimpleWorkerRequest swr = new SimpleWorkerRequest(string.Empty, string.Empty, tw);
HttpRuntime.ProcessRequest(swr);

... and that has done it's purpose. *Application_Start* was called, (I've checked response, it was containing login page that was supposed to be displayed in initial request) and on Application Pool shutdown application ended gracefully by doing necessary work in *Application_End*.

BUT

After the application was started (preloaded and initiated) in this manner, this is what happened when I wanted to reach application via Web browser:

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

I am unable to figure this out. Can anybody tell me why this happens and how to fix it?

If I don't figure this out, I will go back to first solution (sending GET request from code) but this problem will bug me since I don't even have an idea what's wrong.

This question is related to c# asp.net iis web-applications

The answer is


You could fix it by change the "ExtensionlessUrlHandler-Integrated-4.0" type in iis to System.Web.DefaultHttpHandler


In my case (Windows 10 + IIS 10) i had to open "Turn Windows Features On or Off" and then go to Internet Information Services > World Wide Web Services > Application Development Features > and check ASP.NET 4.6


Installing .NET 4.7 worked for me. I only had 3.5 installed prior. enter image description here


Try to re-register ASP.NET with aspnet_regiis -i. It worked for me.

A likely path for .NET 4 (from elevated command prompt):

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

http://forums.iis.net/p/1190643/2026401.aspx


I was facing this issue in a web application hosted on a shared hosting server. So obviously did not have direct access to IIS, so could not apply many solution proposed here.

On the hosting provider's control panel I enabled error logging for IIS and ASP.Net. And then got to know that error actually lied in a missing cshtml.


Making this its own post because this had me going for hours.

I saw maybe a dozen of similar posts here and elsewhere about this problema and the aspnet_regiis fix. They weren't working for me, and aspnet_regiis was acting odd, just listing options etc.

As user ryan-anderson above indicated, you cannot enter .exe

For those less comfy with things outside IIS on the server, here's what you do in simple steps.

  1. Find aspnet_regiis in a folder similar to this path. c:\Windows\Microsoft.NET\Framework\v4.0.30319\

  2. Right-click command prompt in the start menu or wherever and tell it to run as administrator. Using the windows "Run" feature just won't work, or didn't for me.

  3. Go back to the aspnet_regiis executable. Click-drag it right into the command prompt or copy-paste the address into the command prompt.

  4. Remove, if it's there, the .exe at the end. This is key. Add the -i (space minus eye) at the end. Enter.

If you did this correctly, you will see that it starts to install asp.net, and then tells you it succeeded.


For Windows 10 / Windows Server 2016 use the following command:

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

The suggested answers with aspnet_regiis doesn't work on Windows 10 (Creators Update and later) or Windows Server 2016:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
Microsoft (R) ASP.NET RegIIS version 4.0.30319.0
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation. All rights reserved.
Start installing ASP.NET (4.0.30319.0).
This option is not supported on this version of the operating system. Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Windows Features On/Off" dialog, the Server Manager management tool, or the dism.exe command line tool. For more details please see http://go.microsoft.com/fwlink/?LinkID=216771.
Finished installing ASP.NET (4.0.30319.0).

Interestingly, the "Turn Windows Features On/Off" dialog didn't allow me to untick .NET nor ASP.NET 4.6, and only the above DISM command worked. Not sure whether the featurename is correct, but it worked for me.


For me, removing WebDAV from my server caused the application to return a 503 Service Unavailable Error message when using PUT or DELETE, so I re-installed it back again. I also tried completely removing .NET Framework 4.5 and reinstalling it and also tried re-registering as suggested but to no avail.

I was able to fix this by disabling WebDAV for the individual application pool, this stopped the 'bad module' error when using PUT or DELETE.

Disable WebDAV for Individual App Pool:

  1. Click the affected application pool
  2. Find WebDAV Authoring Tools in the list
  3. Click to open it
  4. Click Disable WebDAV in the top right.

Ta daaaa!

I still left the remove items in my web.config file.

 <system.webServer>
    <modules>
      <remove name="WebDAVModule"/>
    </modules>
    <handlers>
      <remove name="WebDAV" />
    </handlers>
 <system.webServer>

This link is where I found the instructions but it's not very clear.


I also ran into that problem. My MVC4 App is running on a Windows Server 2012 R2 with IIS 8.5. None of these posted solutions worked for me...installing the missing frameworks through IIS Features could have solved it but the installation always failed.

I had to use the Web Platform Installer and installed the following packages:

enter image description here


This https://stackoverflow.com/a/13266763/1277458 works perfectly. But if you have 64-bit operation system use Framework64 instead of Framework in path:

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

Despite following most of the advice on this page, I was still getting problems on Windows Server 2012. Installing .NET Extensibility 4.5 solved it for me:

Add Roles and Features > Server Roles > Web Server (IIS) > Web Server > Application Development > .NET Extensibility 4.5


I was challenged by the same error message, with .net 4.7 installed.

The solution was to follow one earlier mentioned post to go with the "Turn Windows feature on or off", where the ".NET Framework 4.7 Advanced Services" --> "ASP.NET 4.7" already was checked.

Further down the list, there is the "Internet Information Services" and subnote "Application Development Features" --> "ASP.NET 4.7", that also needs to be checked.

When enabling this, allot of other features are enabled... I simply pressed the Ok button, and the issue was resolved. Screendump of the windows features dialog


Make sure that you have set your application-site version from v2.0 to v4.0 in IIS Manager:

Application Pools > Your Application > Advanced Settings > .NET Framework Version

After that, install your ASP.NET.

For 32-Bit OS (Windows):

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

For 64-Bit OS (Windows):

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

Restart your application-site in IIS Manager and enjoy.


Run one of these commands :

For 32 Bit Windows OS:

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

For 64 Bit Windows OS:

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -I

I know this is an oldie, but thought I might add some value. For those of us running Server Core outside of a domain (domain members can just run Server Manager remotely to add/remove features/roles), you have to resort to command lines.

Powershell users can type "Install-WindowsFeature Web-Asp-Net45"

That should be equivalent to using server manager.


I had this problem and found that removing the following folder helped, even with the non-Express edition.Express:

C:\Users\<user>\Documents\IISExpress


This error started happening to me out of nowhere last week, affecting the existing web sites on my machine. I had no luck with it trying any of the suggestions here. Eventually I removed WebDAV from IIS completely (Windows Features -> Internet Information Services -> World Wide Web Services -> Common HTTP Features -> WebDAV Publishing). I did an IIS reset after this for good measure, and my error was finally resolved.

I can only guess that a Windows update started the issue, but I can't be sure.


I'm working on Windows Server 2012. .NET Extensibility 4.5 feature is on. WebDAVModule removed. I was still getting 500.21 error on ASP.NET route '/docs'.

Changing 'skipManagedModules' to false fixed the problem.

<applicationInitialization doAppInitAfterRestart="true" skipManagedModules="false">
        <add initializationPage="/docs" />    
</applicationInitialization>

Thanks to https://groups.google.com/forum/#!topic/bonobo-git-server/GbdMXdDO4tI


If you're running into this error with Windows 8/Windows Server 2012 and .Net 4.5 follow these instructions here: http://www.britishdeveloper.co.uk/2013/01/handler-extensionlessurlhandler.html

Go to "turn Windows features on or off" Then Internet Information Services Then World Wide Web Services Then Application Development Features And then enable ASP.NET 4.5

This worked for me (although the wizard and wording is a little different in Windows Server 2012, but you'll figure it out). With this being said, why this is necessary after installing everything through the Web Platform Installer including all of the dependencies is completely beyond me...


I solved this problem, adding in "Turn Windows features on or off" The option ASP.NET 4.7

enter image description here


This maybe not a usefull solution for OP but it concerns the same "error" message.

We are hosting PHP pages on IIS8.5 with .NET 4.5 installed correctly.

We make use of the preload functionality to make sure our application is always responsive across the board.

After a while we started getting this error at random.

In the web.config : I put skipManagedModules to true, -> don't do this!

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
<applicationInitialization skipManagedModules="false" doAppInitAfterRestart="true">
  <add initializationPage="/" />
</applicationInitialization>
...

Although website is php, the routing to the paging is managed by the modules!!!


Examples related to c#

How can I convert this one line of ActionScript to C#? Microsoft Advertising SDK doesn't deliverer ads How to use a global array in C#? How to correctly write async method? C# - insert values from file into two arrays Uploading into folder in FTP? Are these methods thread safe? dotnet ef not found in .NET Core 3 HTTP Error 500.30 - ANCM In-Process Start Failure Best way to "push" into C# array

Examples related to asp.net

RegisterStartupScript from code behind not working when Update Panel is used You must add a reference to assembly 'netstandard, Version=2.0.0.0 No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization How to use log4net in Asp.net core 2.0 Visual Studio 2017 error: Unable to start program, An operation is not legal in the current state How to create roles in ASP.NET Core and assign them to users? How to handle Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause() ASP.NET Core Web API Authentication Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0 WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery

Examples related to iis

ASP.NET Core 1.0 on IIS error 502.5 CS1617: Invalid option ‘6’ for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default Publish to IIS, setting Environment Variable IIS Manager in Windows 10 The page cannot be displayed because an internal server error has occurred on server The service cannot accept control messages at this time NuGet: 'X' already has a dependency defined for 'Y' Changing project port number in Visual Studio 2013 System.Data.SqlClient.SqlException: Login failed for user "This operation requires IIS integrated pipeline mode."

Examples related to web-applications

Spring - No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call How do I choose the URL for my Spring Boot webapp? Difference between MEAN.js and MEAN.io External VS2013 build error "error MSB4019: The imported project <path> was not found" How to unpackage and repackage a WAR file IntelliJ, can't start simple web application: Unable to ping server at localhost:1099 Using form input to access camera and immediately upload photos using web app Pass user defined environment variable to tomcat ASP.NET: HTTP Error 500.19 – Internal Server Error 0x8007000d Best practices when running Node.js with port 80 (Ubuntu / Linode)