Aspnetcore.docs: getting - Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list using IIS

Created on 7 Dec 2018  路  14Comments  路  Source: dotnet/AspNetCore.Docs

I am trying to write a 'web API with ASP.NET Core' app, but after deploying it on IIS getting
below error

HTTP Error 500.21 - Internal Server Error
Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list

P4

Most helpful comment

Just for info:
Installing the hosting bundle 2.2.1 solved the problem.
The SDK is not enough although it contains the runtime, however, I think it's not registering the module V2 correctly on the server's OS.

All 14 comments

Hello @msinghm ... looks like you don't have the hosting bundle installed on the server.

See :point_right: https://docs.microsoft.com/aspnet/core/host-and-deploy/iis/#install-the-net-core-hosting-bundle

I'll close as answered. I think you'll find everything you need in the docs to proceed. Let us know if you run into any trouble with any of the hosting and deployment topics. There's a Content feedback button at the bottom of every topic.

Thanks so much Luke Latham, I am able to fix the issue using your reply.

@guardrex I am trying to debug from VS2017 using IISExpress. I installed .net core hosting bundle, restarted pc but I am still getting the same error.

Thanks

@pantonis Navigate to ...

%ProgramFiles%\IIS Express\Asp.Net Core Module\V2\

Do you see the ancm v2 there? ...

capture

@pantonis If the ANCM V2 is there and you're still having trouble with this exception, open an issue on the aspnet/AspNetCore issues. We probably can't troubleshoot it here on the docs repo.

https://github.com/aspnet/AspNetCore/issues?page=2&q=is%3Aissue+is%3Aopen

Later if you figure out that we're missing some coverage, open a new issue from the Common errors topic at the bottom using the Content feedback button.

It was resolved after I updated VS2017 to latest version.
Thanks for the help

Just for info:
Installing the hosting bundle 2.2.1 solved the problem.
The SDK is not enough although it contains the runtime, however, I think it's not registering the module V2 correctly on the server's OS.

I was trying to host my .Net Core 2.2 app in IIS (Local) and got same message.

Even though I had .Net Core SDK 2.2 I got same error message.

Installing .NET Core 2.2 Runtime & Hosting Bundle solved my issue. I only had Hosting Bundle 2.1 version installed.

I get this exact message, yet I'm publishing it with the --self-contained option using the CLI. If installing the hosting bundle solves the problem, doesn't this mean by definition that it's _not_ self contained?

I did not install the hosting bundle yet because I'm looking for a self-contained application.

The app is self-contained but still requires the ASP.NET Core Module for IIS. You can run the hosting bundle installer with switches that will prevent the runtime install. See the IIS Overview topic for details.

The app is self-contained but still requires the ASP.NET Core Module for IIS.

@guardrex, doesn't it contradict to the definition of being self-contained?..

@AKlaus "Self-contained" in the context of a .NET Core app just means that the app contains the .NET Core libs and runtime. It doesn't extend more broadly than that. The alternative, framework-dependent, requires a shared framework on the host. And note that self-contained doesn't include native dependencies on the host, so it really requires even more than just the ANCM to run properly (under IIS).

See the .NET Core app deployment doc for details :point_right: https://docs.microsoft.com/dotnet/core/deploying/.

Is there a solution when publishing to a hosting provider that doesn't allow installing anything. I have to change AspNetCoreModuleV2 to AspNetCoreModule after every publish. I've tried to prevent the web.config from changing without success.

@roboriaan See the <IsTransformWebConfigDisabled> property ....

https://docs.microsoft.com/aspnet/core/host-and-deploy/iis/#webconfig-file

... and include your own custom web.config file in the project's content root (alongside the project file). On publish, it should move the file into your published output for deployment. It won't change your custom web.config file settings when it moves the file.

Was this page helpful?
0 / 5 - 0 ratings