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 listMy 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/9897: The 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.
.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
Post a Comment