Failed to load aspnetcorev2.dll hosting ASP.NET Co

2020-06-12 03:27发布

问题:

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:

Registered IIS modules:

The application pool is configured in the following way:

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:

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.

回答1:

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.



回答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



回答3:

download Microsoft Visual C++ 2015 Redistributable here

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

and reinstall hosting bundle.