Issues After Uninstalling Windows Server Hosting .NET Core 2.0

Adrian Jenkins
3 min readMay 12, 2022

--

You have uninstalled Windows Server Hosting and Runtime of .NET 2.0,as you want to use a supported version. After installing new Hosting and Runtime .NET 6.0, you will find yourself with the following error:

HTTP Error: 500.19

Error Code: 0x8007000d

Description: The requested page cannot be accessed because the related configuration data for the page is invalid.

If you do a quick search you will find the following

“This problem occurs because the ApplicationHost.config or Web.config file contains a malformed or unidentified XML element. IIS can’t identify the XML elements of the modules that are not installed[…]”

However, when you look at those files, nothing obvious jumps to the eye.

In addition to this, when you try to browse through your IIS Manager you will get these kind of errors:

Quick Solution

Repair the Windows Server Hosting that you have just downloaded (.NET 6.0).

This should address the strange behavior in IIS Manager.

However, if you browse to your site (assuming you are using AspNetCoreModule), you will see the following error:

HTTP Error: 500.21

Description: ‘Handler “aspNetCore” has a bad module “AspNetcoreModule” in its module list’

Example of a “web.config” file that caused this issue:

This is because now the module is called “AspNetCoreModuleV2” not “AspNetCoreModule”. When uninstalling Hosting Bundle .NET Core 2.0 that got removed.

After replacing “AspNetCoreModule” with “AspNetCoreModuleV2” your application should be working fine.

Explanation:

Installing .NET Core 2.0 Windows Hosting Bundle does the following:

  • Install “C:\Windows\System32\inetsrv\ aspnetcore.dll”.
  • Under <sectionGroup name=”system.webServer”> in “applicationHost.config: file it adds:

<section name=”aspNetCore” overrideModeDefault=”Allow” />

  • Under <globalModules> in “applicationHost.config” file it adds:

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

  • Under <modules> in “applicationHost.config” file it adds:

<add name=”AspNetCoreModule” />

After uninstalling .NET Core 2.0 Hosting Bundle and installing .NET Core 6.0 Hosting Bundle this happens:

  • Under <sectionGroup name=”system.webServer”> in “applicationHost.config” file it removes:

<section name=”aspNetCore” overrideModeDefault=”Allow” />

  • Under <globalModules> tag, in “applicationHost.config” file, it removes and adds:

REMOVES:

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

ADDS:

<add name=”AspNetCoreModuleV2" image=”%ProgramFiles%\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll” />

  • Under <modules> tag, in “applicationHost.config” file it removes and adds:

REMOVES:

<add name=”AspNetCoreModule” />

ADDS:

<add name=”AspNetCoreModuleV2" />

  • Removes “C:\Windows\System32\inetsrv\ aspnetcore.dll”

After doing this, whole IIS Sites become useless and we get 500.19 when browsing to it.

We know that repairing .NET Core Hosting Bundle 6.0 will fix this behavior. We also know that we need to point to the right module(“AspNetCoreModuleV2) in our “web.config”.

But, what actually happened when we repaired the Hosting Bundle?

Only one thing changed in “applicationHost.config” file:

  • Under <sectionGroup name=”system.webServer”> it added the following:

<section name=”aspNetCore” overrideModeDefault=”Allow” />

My thought here is that, as we are modifying it in our “web.config”, it goes and check in “applicationHost.config” file if this can be done. However, it does not find any instructions and blames it on configuration. This is why we got 500.19.

Hope this can help someone…

--

--

No responses yet