Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 852
Nikolay Arhangelov Avatar asked Jan 25 '19 15:01

Nikolay Arhangelov


3 Answers

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.

like image 174
Nikolay Arhangelov Avatar answered Nov 18 '22 02:11

Nikolay Arhangelov


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

like image 2
Kevin.Debeil Avatar answered Nov 18 '22 03:11

Kevin.Debeil


download Microsoft Visual C++ 2015 Redistributable here

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

and reinstall hosting bundle.

like image 1
Will Wu Avatar answered Nov 18 '22 03:11

Will Wu