IIS: Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list
Solution 1:
Windows IIS
Solution: Install the hosting bundle.
Reason: Although the SDK normally contains the runtime, however, it seems the SDK installer is not registering the runtime correctly on the server.
Workaround (not recommended):
Change AspNetCoreModuleV2
to AspNetCoreModule
inside web.config.
Azure platform hosting
Install the .NET Core runtime extension by selecting Extensions and then installing .NET Core Runtime.
Solution 2:
Install .Net Core 2.2 run-time bundle on hosting machine.
Or
Publish your project as self-contained.
Solution 3:
By removing V2 from modules="AspNetCoreModuleV2" worked for me. Note that my issue was related to running a .net core web api from visual studio. IE Express failed with a code 500 and upon investigating the error log describing "Handler 'aspNetCore' has a bad module.." was resolved by replacing with the below.
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
Solution 4:
UPDATE
This is a workaround that keeps your app on pre-v2 hosting. Please see alans answer and my comment for a more complete solution
ORIGINAL
I got this to work by adding the following code block to the .csproj
for the web application.
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>latest</LangVersion>
<AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
Obviously you'll want to update the netcoreapp
version as you move on. This is how I was able to get things working. I'm not sure why simply installing the hosting bundle for 2.2 wasn't enough.