Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list

In my project, I use the newest Net Core 2.2, but I got the error:

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

My Web.Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath=".\xxx.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout">
        <environmentVariables>
          <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
        </environmentVariables>
      </aspNetCore>
      <httpErrors errorMode="Detailed" />
      <asp scriptErrorSentToBrowser="true" />
    </system.webServer>
    <system.web>
      <customErrors mode="Off" />
      <compilation debug="true" />
    </system.web>
  </location>
</configuration>

Note: The italic lines are there for debugging only.

Cause

https://github.com/aspnet/Docs/issues/9897The hosting bundle must be installed in IIS even though it's for a self-contained application!

For more detail: 


With .NET Core 2.2 comes a new IIS module, AspNetCoreModuleV2. This isn’t an update for the existing AspNetCoreModule but a new module itself. Old apps using the AspNetCoreModule will continue to work the same.

Quick Workaround

Simply remove V2 from modules="AspNetCoreModuleV2". This is safe as long as long as "hostingModel=“InProcess" is not used.


Comments

Popular posts from this blog

Use GnuPG Tools or C# Code for PGP Encryption and Signature

Errors in Net Core Add-Migration

Confusing Concepts about SFTP: SSH2 vs OpenSSH