.NET core 3.1 app shows "Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list"
Solution 1
You will have to ask your hosting provider to install the ASP.NET Core 3.1 Hosting Bundle which includes the Version 2 of the ASP.NET Core Module for IIS.
ASP.NET Core 3.x applications require this module version in order to run on IIS. With the Version 1 module you can only run ASP.NET Core 2.x applications.
The second version of the module is actually bundled since ASP.NET Core 2.2, so this makes me think that your hosting provider hasn’t kept its setup up to date at all.
Note that the module is not related to what you are actually running on the server. If you create a self-contained deployment, then that package will contain everything to run your application. That way you can run the latest ASP.NET Core version even if the server itself did not install the necessary runtime. So you are independent of what your runtimes your hoster installed. But if you want to run it through IIS, you will still need the hosting bundle.
Solution 2
If the underlying web server is IIS, which sounds like it is, you should recycle the application pool if you haven't already. I got this once after upgrading to 3.1 from 2.2 but it disappeared after recycling.
Related videos on Youtube
Michel
Updated on September 15, 2022Comments
-
Michel over 1 year
I just deployed a my converted (2.2 -> 3.1) .NET core ASP.NET MVC app to my shared hosting provider.
I published it from VS2019 to my file system to a private folder and then FTP'd it to the server.
But when I run it, it says:
HTTP Error 500.21 - Internal Server Error Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list
I can see that the publishing wizard add's a web.config (tried removing that, but that didn't work) with this line:
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
So I guess that's where the
AspNetCoreModuleV2
comes from.Tried to remove the '2', tried with 'self-contained' and 'framework-dependant' deployment mode, and tried with x64 and x86, nothing worked.
Previous version was NET CORE 2.2, which worked.
I can't figure out whether the
V2
has something to do with .NET CORE V2.x, or not. -
Michel over 4 yearsWill try that (if I can, via the plesk panel)
-
Michel over 4 yearsIt's IIS (error message windows also says "IIS core does not recognize the module.", but the plesk panel doesn't let me recycle the app pool.
-
Michel over 4 yearsI also tried the option "self contained app' when publishing. Doesn't this package every file it needs? I did see it creating a whole lot more files than when I didn't
-
poke over 4 years@Michel See the edit I just made. If you have a “framework dependent” deployment, then you are relying on the .NET Core runtime being installed by your hosting provider. By using a self-contained deployment, you will include everything you need, so you don’t have to rely on an installed runtime. But you will still need the hosting bundle for the IIS.
-
Michel over 4 yearsOk, thanks for the quick reply. Will create a support ticket. Hope you are right, then will accept this answer. Was not aware that IIS also needs an update for a new .NET core framework.
-
Michel over 4 yearsVery sad. They did install the hosting package, but they now say that Plesk (which is installed to let me manage some parts of my server) doesn't support .NET CORE 3 (yet)
-
poke over 4 years@Michel That’s a shame. Although, according to this comment it might still work, so maybe check to see if simply installing the bundle was already enough.
-
NoloMokgosi about 4 years"You will have to ask your hosting provider to install the ASP.NET Core 3.1 Hosting Bundle which includes the Version 2 of the ASP.NET Core Module for IIS." worked for me. Initially I installed desktop version and spent time trying to figure out what's wrong.
-
Traderhut Games about 2 yearsAny other ideas? I have two Windows 10 machines, one where I developed it, and the other where I was running it. I republished it to the folder (after making one change, as far as I can tell, just a cshtml change on a view that isn't being called), I'm now getting this error. Shut down site, cycled pool, installed the hosting bundle from your link (just in case) and still down...
-
Traderhut Games about 2 yearsOH, and I'm running .Net Core 2.1, attempts to get 3.x running have been WIP for a while
-
poke about 2 years@TraderhutGames You should install both a current .NET Hosting Bundle (e.g. of .NET 6) and a .NET Runtime for ASP.NET Core 2.1. And then make sure your
web.config
actually usesAspNetCoreModuleV2
(note the V2; you will have to change the generated web.config since 2.1 still uses the V1 module). -
Traderhut Games about 2 years@poke Thanks, that is what I did yesterday... Well, my handler doesn't have the V2 (couldn't figure out how to tell the project to change that), but using the AspNetCoreModule worked just fine... And I can now just publish directly into the folder, and it works (although, might need to stop webserver while I publish, as it had an issue with an open file) (Technically, it was published into another folder and then copied over, which got the error, so I had to stop and then copy, restart, but that is normal)