500.21 Bad module "ManagedPipelineHandler" in its module list - asp.net

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.

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

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.

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.

Try switching to Integrated mode. See the following thread:
IIS 7, HttpHandler and HTTP Error 500.21

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):
Then click next to Features and make sure the following is checked:
Then click next and Install. At this point, the error went away for me. Good luck!

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

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)

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.

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.

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

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.

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.

Related

Custom handlers for ASP.NET 2.0 Website in Classic mode in IIS 8.5 throwing 500 error

I have ASP.NET 2.0 website running in Classic Mode.
Server 2001/IIS 8.5.
I get this error when calling custom handler (something.abc).
I have my handler(something.abc) added to <system.webServer><handlers> section
<add name="Something.abc" verb="GET,HEAD" path="something.abc" type="ABC.MyHttpHandler, ABC" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified"/>
It was working fine in local IIS Express.
On Server when I changed the Application Pool setting: Enable 32-bit Applications= True it started working.
Question: Why I had to turn 32-bit mode and is there any way I can make it work without enabling 32-bit?
I ran into this problem with an application running on a new Windows Server 2016 box with IIS 10.
It was working on the old Server 2012 box because that one had the 32-bit Oracle client installed, but the new server had the 64-bit Oracle client installed, and I was therefore unable to set Enable 32-bit Applications= True without causing other problems.
The worker process was also set up to use Classic pipeline instead of Integrated, another setting that I could not change in order to get this to work. ASP.NET was properly installed too. (i.e. this solution did not help me.)
I had:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="Something.abc" verb="*" path="something.abc" type="ABC.MyHttpHandler, ABC" resourceType="Unspecified" />
To solve this issue I added BOTH of these attributes (it did not work with only one or the other):
modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll"
i.e. final result was:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="Something.abc" verb="*" path="something.abc" type="ABC.MyHttpHandler, ABC" resourceType="Unspecified" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" />

Publish Web Api (MVC 4)

I built a REST API following this tutorial and this one, and when I run application from Visual Studio 2012 things seem to work properly.
The problem is when I publish (to file system), I get a new folder under wwwroot and some files are placed there, but when I try to access http://localhost:82/my_published_api/ I only see a list of what seems useless files, http://localhost:82/my_published_api/api/ throws a 404 as does http://localhost:82/my_published_api/api/contact/ which is actually working from VStudio.
Am I missing something? What do I need to publish to a directory and access api modules?
EDIT some extra info:
This is system.web section in Web.Config:
<system.web>
<httpRuntime/>
<compilation debug="true" targetFramework="4.0"/>
<pages controlRenderingCompatibilityVersion="4.0">
<namespaces>
<add namespace="System.Web.Helpers"/>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Ajax"/>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="System.Web.Routing"/>
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
</system.web>
And pre-production published version is running in http://localhost:82/my_published_api/ (this is the one which throws 404) while Visual Studio runtime server runs in http://localhost:51976/api/contact/ (this one runs properly)
Pre-production site is IIS under Windows 7, real production site will be a Windows server 2003.
Thank you

HTTP Error 500.22 - Internal Server Error (An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.)

I receive this error when I view an application.
HTTP Error 500.22 - Internal Server Error (An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.)
.Net framework 2.0, 3.5 and 4 are installed and I am using SQL 2008. Can anyone tell me what the solution is for this error?
This issue is caused by the pipeline mode in your Application Pool setting that your web site is set to.
Short
Simple way Change the Application Pool mode to one that has Classic pipeline enabled.
Correct way Your web.config / web app will need to be altered to support Integrated pipelines. Normally this is as simple as removing parts of your web.config.
Simple way (bad practice) Add the following to your web.config. See http://www.iis.net/ConfigReference/system.webServer/validation
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
Long
If possible, your best bet is to change your application to support the integrated pipelines. There are a number of changes between IIS6 and IIS7.x that will cause this error. You can find details about these changes here http://learn.iis.net/page.aspx/381/aspnet-20-breaking-changes-on-iis-70/.
If you're unable to do that, you'll need to change the App pool which may be more difficult to do depending on your availability to the web server.
Go to the web server
Open the IIS Manager
Navigate to your site
Click Advanced Settings on the right Action pane
Under Application Pool, change it to an app pool that has classic enabled.
Check http://technet.microsoft.com/en-us/library/cc731755(WS.10).aspx for details on changing the App Pool
If you need to create an App Pool with Classic pipelines, take a look at http://technet.microsoft.com/en-us/library/cc731784(WS.10).aspx
If you don't have access to the server to make this change, you'll need to do this through your hosting server and contact them for help.
Feel free to ask questions.
In your web.config, make sure these keys exist:
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
I changed my web.config file to use HTTPMODULE in two forms:
IIS: 6
<httpModules>
<add name="Module" type="app.Module,app"/>
</httpModules>
IIS: 7.5
<system.webServer>
<modules>
<add name="Module" type="app.Module,app"/>
</modules>
</system.webServer>
Using VS2013 .net 4.5
I had this same issue.
The "Most likely causes" section on the error message page provided the most help. For me. It said "This application defines configuration in the system.web/httpModules section." Then in the "Things you can try" section it said "Migrate the configuration to the system.webServer/modules section."
<system.web>
<httpHandlers>
<add type="DevExpress.Web.ASPxUploadProgressHttpHandler, DevExpress.Web.v15.1, Version=15.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET,POST" path="ASPxUploadProgressHandlerPage.ashx" validate="false" />
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v15.1, Version=15.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" path="DX.ashx" validate="false" />
</httpHandlers>
<httpModules>
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v15.1, Version=15.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" />
</httpModules>
</system.web>
into the system.webServer section.
<system.webServer>
<handlers>
<add type="DevExpress.Web.ASPxUploadProgressHttpHandler, DevExpress.Web.v15.1, Version=15.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET,POST" path="ASPxUploadProgressHandlerPage.ashx" name="ASPxUploadProgressHandler" preCondition="integratedMode" />
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v15.1, Version=15.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" path="DX.ashx" name="ASPxHttpHandlerModule" preCondition="integratedMode" />
</handlers>
<modules>
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v15.1, Version=15.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" />
</modules>
</system.webServer>
This worked for me:
Delete the originally created site.
Recreate the site in IIS
Clean solution
Build solution
Seems like something went south when I originally created the site. I hate solutions that are similar to "Restart your machine, then reinstall windows" without knowing what caused the error. But, this worked for me. Quick and simple. Hope it helps someone else.
I have a similar problem with IIS 7, Win 7 Enterprise Pack. I have changed the application Pool as in #Kirk answer :
Change the Application Pool mode to one that has Classic pipeline enabled".but no luck for me.
Adding one more step worked for me.
I have changed the my website's .NET Frameworkis v2.0 to .NET Frameworkis v4.0. in ApplicationPool
Personnaly I encountered this issue while migrating a IIS6 website into IIS7, in order to fix this issue I used this command line :
%windir%\System32\inetsrv\appcmd migrate config "MyWebSite\"
Make sure to backup your web.config
Set Application pool to classic .NET appool and make sure that Classic .Net apppool working on Classic managed piple line .

URL Rerouting failing on IIS 7 do i need to add any configuration to set it up?

URL Rerouting failing on IIS 7 do i need to add any configuration to set it up ?
I was previously using IIS 6 and did not specify any configuration settings. My app is built on asp.net 4.0. I tried to add the following config but still it failed.
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="RoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
Please make sure that you are running under IIS 7.0 Integrated mode. If you need to run it under IIS 7.0 Classic mode, you need to perform several actions to make the routes work. Please refer the following blog posts;
http://www.tugberkugurlu.com/archive/running-asp-net-mvc-under-iis-6-0-and-iis-7-0-classic-mode---solution-to-routing-problem
http://www.tugberkugurlu.com/archive/deployment-of-asp-net-mvc-3-rc-2-application-on-a-shared-hosting-environment-without-begging-the-hosting-company

Could not load type 'System.ServiceModel.Activation.HttpHandler' Version conflict with WCF REST

I've run into a problem with WCF REST Service. I get:
Could not load type 'System.ServiceModel.Activation.HttpHandler' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
when running inside of the IIS in an ASP.NET 4.0 AppPool.
The problem seems to occur only if:
Running inside of IIS
When ASP.NET Comaptibility is enabled
Running in Cassini - no problem it works properly. Running with ASP.NET compatibility off - no problem it works.
It appears that it's some sort of handler version conflict trying to instantiate the wrong version of the handler that in turn tries to load an older version of System.ServiceModel, but I haven't been able to trace this down.
Anybody seen anything like this before and have any ideas how to track this down further?
I've looked in ApplicationHost.config and the master web.config files for System.ServiceModel and HttpHandler references but no luck. There.
+++ Rick ---
fire up your Visual Studio 2010 Command Prompt or browse to "C:\Windows\Microsoft.NET\Framework\ v4.0.30319". And run the following command from the command prompt:
aspnet_regiis.exe -iru
This will register latest .net version. Also make sure your app pool is running latest version of .net
So as expected this turned out to be a versioning conflict in the default handler mappings in ApplicationHost.config. Specifically IIS has mappings for ASP.NET 2.0 and ASP.NET 4.0 specific references to the service activation handler (and module) and the 2.0 references weren't restricted by a version specific preCondition.
To fix the above problem I had to change (at the System root in ApplicationHost.config):
<add name="svc-Integrated" path="*.svc" verb="*"
type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
preCondition="integratedMode" />
to:
<add name="svc-Integrated" path="*.svc" verb="*"
type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
preCondition="integratedMode,runtimeVersionv2.0" />
Note the EXPLICIT runtimeVersion2.0. There are additional *.svc maps in the same section for the runtimeVersion4.0 which then fire the appropriate runtimes.
According to Microsoft this situation can arise when some older tools (I'm guessing Azure tools???) are installed that don't register the runtime version properly.
Problem solved.
There is one more way if all of above doesn't work. (Strange)
We were using Windows Server 2008 R2 SP1 with IIS 7.5.7600
After registering latest framework as given in above answer,
You need to the add handler mapping to v.4.0 assembly manually to web.config and remove "ServiceModel" from Modules.
<system.webServer>
<handlers>
<remove name="svc-Integrated" />
<add name=".svc" verb="*" path="*.svc" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory,
System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
<modules>
<remove name="ServiceModel" />
</modules>
</system.webServer>
More here

Resources