ChatGPT解决这个技术问题 Extra ChatGPT

500.21 Bad module "ManagedPipelineHandler" in its module list

I am getting the error:

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

my web.config file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="CloudConnectHandler" verb="*" path="CloudConnect.aspx" type="CloudConnectHandler" resourceType="Unspecified" />
    </handlers>
  </system.webServer>
  <system.web>
    <customErrors mode="Off" />
    <compilation debug="true" targetFramework="4.0" batch="false">
      <assemblies>
        <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
      </assemblies>
    </compilation>
    <pages>
      <controls>
        <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
      </controls>
    </pages>
        <identity impersonate="true" />
        <authentication mode="Forms" />
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v4.0" />
        <providerOption name="WarnAsError" value="false" />
      </compiler>
    </compilers>
  </system.codedom>
  <appSettings>
    <add key="CloudConnectAuthorization" value="xxxx" />
    <add key="ConnectionInfo" value="xxxx" />
    <add key="ConnectionString" value="xxxx" />
    <add key="DefaultChannel" value="xxxx" />
    <add key="LoginValidationConnectionString" value="xxxx" />
  </appSettings>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="protobuf-net" publicKeyToken="257b51d87d2e4d67" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.640" newVersion="2.0.0.640" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

There is a lot of advice out there indicating that asp.net is not installed correctly. The usual fix is to run:

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

or

%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i

I have run both, without any errors. I have restarted IIS, but the problem still persists. The site is using an application pool. The app pool is started, .net framework = 4.0, Managed Pipeline = Classic, Identity = LocalSystem.

I've spent the last couple hours trying to figure out what the problem is. I'm hoping someone can help.

I had to add the attribute to solve the 500.21 error that I was getting

a
ataravati

Please follow these steps:

1) Run the command prompt as administrator.

2) Type either of the two lines below in the command prompt:

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

or

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

Welcome to SO and thanks for your answer. This answer has been flagged for review because of its brevity. While your answer may be technically correct, it could be improved with some more text, explaining what the underlying problem is that the OP is having, and why your answer works.
here's the more text. cause it works muhahahaha +1. I think the real reason is if you install 4.5.1 first then stick IIS on it doesn't automagically recognize right. or I have that in reverse order. either way. this worked for me
This is the solution!
I'm building a new 2008 R2 server (yes, in the year 2015) and I installed 4.5.x first and then stuck IIS on afterwards.. like @hubsonBropa mentioned in his comment. This got me past the first of many hurdles.
If you are using .NET 4.5.x or 4.6.x, don't be fooled by the answer mentioning 4.0 and thinking it doesn't apply to you. This problem can be related to the order of installation of .NET before IIS, as it was for me. Running the command (in my case the 64 bit version) fixed it even though my application is using .NET 4.5.2.
J
Jeremy Cook

I ran into this error on a fresh build of Windows Server 2012 R2. IIS and .NET 4.5 had been installed, but the ASP.NET Server Role (version 4.5 in my case) had not been added. Make sure that the version of ASP.NET you need has been added/installed like ASP.NET 4.5 is in this screenshot.

https://i.stack.imgur.com/VxNNn.png


It is now ASP.NET 4.7 (Svr 2016)
T
Tim Murphy

To fix the problem, I tried to run

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

However It didn't work for me. I have to run another command line in CMD window as administrator. Here is the command:

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

or

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

Hope it will help.


This solved it for me as well on Window 10 Preview Build 10074 with IIS 10.
The dism command worked for me after removing the % from the beginning. So I ran: dism /online /enable-feature /featurename:IIS-ASPNET45 /all.
Works on Windows Server 2016! Thanks a lot!
C
Community

Try switching to Integrated mode. See the following thread:

IIS 7, HttpHandler and HTTP Error 500.21


I had switched it to integrated, which caused a different error. Once I fixed that, everything started working properly. Thank you.
"Down vote" for this. I already had integrated mode enabled. @Armaan answers it brief but perfectly.
This answer is valid, it resolve my problem, I used NET 3.5 and got the 500.21 Error. switch to integrated mode resolved my problem.
R
Rudy Scoggins

I got this error on my ASP.Net 4.5 app on Windows Server 2012 R2.

Go to start menu -> "Turn windows features on or off". A wizard popped up for me.

Click Next to Server Roles

I had to check these to get this to work, located under Web Server IIS->Web Server-> Application Development (these are based on Jeremy Cook's answer above):

https://i.stack.imgur.com/ItUyK.png

Then click next to Features and make sure the following is checked:

https://i.stack.imgur.com/WgQal.png

Then click next and Install. At this point, the error went away for me. Good luck!


E
Evgeny Gorb

This is because IIS 7 uses http handlers from both <system.web><httpHandlers> and <system.webServer><handlers>. if you need CloudConnectHandler in your application, you should add <httpHandlers> section with this handler to the <system.web>:

<httpHandlers>
    <add verb="*" path="CloudConnect.aspx" type="CloudConnectHandler" />
</httpHandlers>

and also add preCondition attribute to the handler in <system.webServer>:

<handlers>
  <add name="CloudConnectHandler" verb="*" path="CloudConnect.aspx" type="CloudConnectHandler" preCondition="integratedMode" />
</handlers>

Hope it helps


N
Neil Thompson

I had this issue in Windows 10 when I needed IIS instead of IIS Express. New Web Project failed with OP's error. Fix was

Control Panel > Turn Windows Features on or off > Internet Information Services > World Wide Web Services > Application Development Features

tick ASP.NET 4.7 (in my case)


L
Luke

For me, I was getting this error message when using PUT or DELETE to WebAPI. I also tried re-registering .NET Framework as suggested but to no avail.

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

Disable WebDAV for Individual App Pool:

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

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


My problem exactly. Put and Delete didn't work with WebDav enabled. Thanks for sharing your finding!
n
neoscribe

I had this problem every time I deployed a new website or updated an existing one using MSDeploy.

I was able to fix this by unloading the app domain using MSDeploy with the following syntax:

msdeploy.exe -verb:sync -source:recycleApp -dest:recycleApp="Default Web Site/myAppName",recycleMode=UnloadAppDomain

You can also stop, start, or recycle the application pool - more details here: http://technet.microsoft.com/en-us/library/ee522997%28v=ws.10%29.aspx

While Armaan's solution helped get me unstuck, it did not make the problem go away permanently.


u
user3024678

if it is IIS 8 go to control panel, turn windows features on/off and enable Bad "Named pipe activation" then restart IIS. Hope the same works with IIS 7


J
Jasper

I discovered that the order of adding roles and features is important. On a fresh system I activate the role "application server" and there check explicitly .net, web server support and finally process activation service Then automatically a dialogue comes up that the role "Web server" needs to be added also.


G
Giulio Caccin

Install .NET framework as below, it will work .NET version 4.5 as well.

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir

Some time only give aspnet_regiis.exe -i don't work so give aspnet_regiis.exe -ir in above path.