19

After updating my project to "Microsoft.AspNetCore.All" 2.2.0, I get an error when running in IIS, but not when running in Visual Studio.

HTTP-Fehler 500.21 - Internal Server Error Der Handler "aspNetCore" weist das ungültige Modul "AspNetCoreModuleV2" in der Modulliste auf.

I don't know what is causing this and the www does not seem to have an answer. Maybe someone facing the same thing and has a solution

Tetsuya Yamamoto
  • 24,297
  • 8
  • 39
  • 61
DirtyNative
  • 2,553
  • 2
  • 33
  • 58

8 Answers8

34

You just need to install this package below. After that you can use the AspNetCoreModuleV2 :)

https://dotnet.microsoft.com/download/thank-you/dotnet-runtime-2.2.2-windows-hosting-bundle-installer

When installing, please notice to install as administrator. As part of the installation the applicationHost.config file will be updated to include AspNetCoreModuleV2 and its dll. this is one of the reasons why it's important to run installation with admin privilege.

MaartenDev
  • 5,631
  • 5
  • 21
  • 33
14

I have the same issue. it is something wrong with AspNetCoreModuleV2:

modules="AspNetCoreModuleV2" 

The site is working when I change the modules to AspNetCoreModule in the web.config:

modules="AspNetCoreModule" 
Dmitriy Fialkovskiy
  • 3,065
  • 8
  • 32
  • 47
Anh N
  • 157
  • 4
  • How can I make my project publish with this automatically? – Jack Feb 24 '20 at 13:43
  • @Jack you can always include a web.config file to the root directory of your project, and it should be used by dotnet tooling as base template whenever you publish. For even more control, you could look into web.config transformations. This may help: https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/web-config-transformations – MrClan Apr 14 '20 at 23:27
1

I'm publishing to a shared host so not able to install the package mentioned.

Changing AspNetCoreModuleV2 to AspNetCoreModule is the solution recommended by my host and seems to work.

Next task is working out how to get VS to write the correct thing so I don't have to edit web.config every time.

Brian Lowe
  • 4,943
  • 1
  • 18
  • 20
1

Modify your .csproj file with code below, then republish.

<PropertyGroup>
  <TargetFramework>netcoreapp2.2</TargetFramework>
  <AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
  <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>

Refer: how-to-install-and-use-the-aspnet-core-module

keikai
  • 14,085
  • 9
  • 49
  • 68
0

Not an answer, but an important and critical component of all the answers here. MAKE SURE YOU RESTART IIS after installing the modules needed.

ATL_DEV
  • 9,256
  • 11
  • 60
  • 102
0

You can Add web.config with Solution Explorer -> Add -> New Item -> Search for "config" -> Add Web Configuration File. This will add web.config in your project with default content enter image description here

copy ur published config xml in to new webconfig and change modules="AspNetCoreModuleV2" to modules="AspNetCoreModule"

hanan
  • 1,768
  • 1
  • 14
  • 19
0

This error message is specific to permissions. However when you encounter this error with no relevant logs or messages, make sure you have the Hosting Bundle for your dotnet version installed in your Windows machine along with the Runtime bundle. I had to installed hosting bundle for iis to get this error sorted out although mine was not related to permissions.

https://dotnet.microsoft.com/en-us/download/dotnet

HostingBundle

Jabez
  • 795
  • 9
  • 18
0

Important note: Do not try to find this module somewhere in the "Add Rules and Features" section. It must be installed from the link that was already mentioned in this question.

This also solves the issue where NONE of the IIS settings could be changed and the following error appears:

There was an error while performing this operation Filename: \?\C:\Something\AppDir\web.config

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 28 '23 at 17:55