Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET core 3.1 app shows "Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list"

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.

like image 462
Michel Avatar asked Jan 04 '20 20:01

Michel


2 Answers

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.

like image 114
poke Avatar answered Oct 16 '22 10:10

poke


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.

like image 1
Visar Avatar answered Oct 16 '22 12:10

Visar