This post will explain how to resolve the error “Handler “aspNetCore” has a bad module “AspNetCoreModuleV2” in its module list” when you deploy your ASP.NET application.
There are times when you might face the below error immediately after you deployed your ASP.NET Core application.
HTTP Error 500.21 – Internal Server Error Handler “aspNetCore” has a bad module “AspNetCoreModuleV2” in its module list
You might notice that the application might be working fine on the localhost or Development machine and the error would be seen only when hosting the application.
The reason for the error is that you are using a different .NET Core version than the one installed in the hosting machine.
For example , I started facing the error because the application that i was deploying was targetting .NET Core 3.1 and few modules was using .NET Core 2.2. The hosting machine has only .NET Core 2.1 installed. so, changing the target version and building them ob .NET Core 2.1 for all the modules sorted out this issue for me.