简体   繁体   中英

ASP.NET CORE Hosting - Error Internal Server Error Handler “aspNetCore” has a bad module “AspNetCoreModule” in its module list

I'm hosting ASP.NET Core 2 site and getting below error message.

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

My application is using nopCommerce 4.00 and server side already ASP.NET Core component is installed.

I was facing the same issue after following this blog on how to host an asp.net core app into IIS. Visual studio had added the following web.config in the published output folder.

在此处输入图片说明

Then I looked into my IIS module to check if the .NET core hosting bundle was installed properly and I saw this,

在此处输入图片说明

So I changed the module in web.config,

<handlers>
  <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>

and it worked without any issues after that.

I had the same error. The handler was AspNetCoreModule , code is %SystemRoot%\\system32\\inetsrv\\aspnetcore.dll . Changing the handler to AspNetCoreModuleV2 with code %ProgramFiles%\\IIS\\Asp.Net Core Module\\V2\\aspnetcorev2.dll solved the problem.

在此处输入图片说明

在此处输入图片说明

This link is also helpful. In case the link doesn't work:

This error can occur if the AspNetCoreModule is not installed properly in IIS on the computer that is running the Microsoft Dynamics NAV Web Server components. The AspNetCoreModule is installed with the Microsoft .NET Core Windows Server Hosting bundle. You can get this error if this has been not been fully installed or the installation has been damaged in some way.

To resolve this issue, open Programs and Features in Control Panel and check whether Microsoft .NET Core Windows Server Hosting is installed. Then, try one of the following:

  • If it is installed, repair it from Programs and Features, by selecting it, choosing Change, and then choosing Repair.

  • If it is not installed, download and install Microsoft .NET Core - Windows Server Hosting bundle.

I was having the same error, I enabled the logs in web.config file by settinig stdoutLogEnabled="true"

<aspNetCore processPath=".\site01.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />

And I found that I am missing the correct version of Microsoft.AspNetCore.App

It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '2.1.12' was not found.
  - The following frameworks were found:
      3.1.2 at [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]

so i installed the ASP.NET Core 2.1 Runtime (v2.1.16) - Windows Hosting Bundle Installer from https://dotnet.microsoft.com/download/dotnet-core/2.1/runtime/?utm_source=getdotnetcore&utm_medium=referral

AND MY PROBLEM WAS SOLVED.

This is exactly the issue that I was having.

I have posted a similar solution here , which solves a different scenario.

After installing the .NET Core Windows Hosting Bundle , and even the SDK, the AspNetCoreModule lines were still missing on applicationHost.config .

AspNetCoreModuleV2 was there, though.

So, I found an applicationHost.config in another server that had those AspNetCoreModule lines and updated the file on the broken server. Not sure why they were not being added by the .NET Core installation on that specific server.

I added the line below under the <globalModules> section:

<add name="AspNetCoreModule" image="%SystemRoot%\\system32\\inetsrv\\aspnetcore.dll" />

And this one under <modules> :

<add name="AspNetCoreModule" />

Hope this helps.

I was having the same error,I change "AspNetCoreModule" to "AspNetCoreModuleV2" in web.config. work fine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM