12

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.

2 Answers 2

10

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.

10
  • I 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
    – Michel
    Jan 4, 2020 at 21:09
  • @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.
    – poke
    Jan 4, 2020 at 21:12
  • Ok, 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
    Jan 4, 2020 at 21:14
  • Very 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)
    – Michel
    Jan 10, 2020 at 11:24
  • 1
    @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 uses AspNetCoreModuleV2 (note the V2; you will have to change the generated web.config since 2.1 still uses the V1 module).
    – poke
    Feb 18, 2022 at 8:08
1

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.

2
  • Will try that (if I can, via the plesk panel)
    – Michel
    Jan 4, 2020 at 21:00
  • It'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
    Jan 4, 2020 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.