Failed to load aspnetcorev2.dll hosting ASP.NET Core 2.2 on IIS7
Asked Answered
V

3

13

I am struggling with deploying an ASP.NET Core 2.2 site to Windows 7 SP1 IIS7.5.

The server has dotnet-hosting-2.2.1-win installed. Following are the Programs and Features entries: Installed Hosting Packages

Registered IIS modules:
enter image description here

The application pool is configured in the following way: enter image description here

The app pool is used only by one web application and is running under a windows account.

I am deploying an ASP.NET Core 2.2 website using the following publish settings: enter image description here

This is the deployed web.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath=".\App.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
    </system.webServer>
  </location>
</configuration>

Whatever I do, the app pool will stop and the following error will show up in the Event Viewer: The Module DLL C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll failed to load. The data is the error.

I tried deploying with:

  • Any CPU/x86/x64
  • win-x64/win-x86/Portable
  • Self-Contained/Framework-dependent
  • hostingModel="InProcess"/hostingModel="OutOfProcess"
  • Enable 32-bit Applications="true"

Also attempted the following workarounds: https://github.com/aspnet/AspNetCore/issues/6118 https://github.com/aspnet/AspNetCore/issues/4206

Whatever I do, I can't make the application pool run. Does anyone know what could be causing those problems?

UPDATE For some reason even the other IIS sites on .NET Framework that used to work before, now can't start with the same error - The Module DLL C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll failed to load. The data is the error.

ANSWER After a lot of digging it turned out that the installer for the hosting bundle failed to download Microsoft Visual C++ 2015 Redistributable. That is why all websites stopped working. I installed it manually and resintalled the hosting bundle and everything worked.

Value answered 25/1, 2019 at 15:54 Comment(0)
V
19

After a lot of digging it turned out that the installer for the hosting bundle failed to download Microsoft Visual C++ 2015 Redistributable. That is why all websites stopped working. I installed it manually and resintalled the hosting bundle and everything worked.

Value answered 25/1, 2019 at 17:16 Comment(5)
You absolute legend! Installing the Visual C++ 2015 Redistributable worked for me too, i'd love to know why? I've checked my dev env and that doens't have it either but doesn't have the same problems.Cutch
I'm having a very similar issue, but this didn't solve it. Tried installing Visual C++ 2015 Redistributable and 2017 -- I also tried dotnet-hosting-2.2.2 but I still have the same error as you did initially.Mev
@Mev , is this affecting all IIS sites or only your .NET Core site?Value
@NikolayArhangelov, correct. All websites are being affected, not only core websites. If I uninstall core hosting bundle, it goes back to normal. I had posted details here but it is marked for deletion: #54259435Mev
Microsoft did mention the installation of Visual C++ 2015 Redistributable: learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/…Medicaid
V
2

I faced the same problem on a Windows Server 2012 R2. I tried to reinstall Microsoft Visual C++ 2015 Redistributable, but the error was still there. What fix the problem for me :

  1. Uninstall Runtime & Hosting Bundle and Microsoft Visual C++ 2015 Redistributable

  2. Run the following command to check and repair file system :

    sfc /scannow

  3. Run the following command to check the Windows image for any corruption and to perform a repair automatically :

    dism /online /cleanup-image /restorehealth

  4. Run Windows Update and install all updates (this can take a while)

  5. Install Runtime & Hosting Bundle from https://dotnet.microsoft.com/download/dotnet-core/2.2

Vermont answered 18/4, 2019 at 8:40 Comment(0)
A
1

download Microsoft Visual C++ 2015 Redistributable here

https://www.microsoft.com/en-us/download/confirmation.aspx?id=52685

and reinstall hosting bundle.

Absorbent answered 2/4, 2020 at 15:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.