aspnetcore.dll failed to load

18,980

Solution 1

Found the solution - the applicationhost.config file had references to ASP.NET Core and was trying to load the non-existent module. I deleted the applicationhost.config file and reopened the solution, which forced VS to rebuild it without the ASP.NET Core references. Works fine now.

In my case with Visual Studio 2015, this file was located in .vs\config\applicationhost.config

For earlier versions of Visual Studio using IIS Express, see this question for more information about where applicationhost.config is located: Where is the IIS Express configuration / metabase file found?

Solution 2

Using VS 2015 (Windows 10). Working on a downloaded sample MVC app (from Intuit) targeting .net 4.6.1.

I was getting the exact same behaivior/error:

"The Module DLL C:\Program Files (x86)\IIS Express\aspnetcore.dll failed to load"

Locating the Applicationhost.config file (part of download package) and deleting it, did not solve the problem because IISExpress re-generated the Applicationhost.config file with the same references.

To solve the problem I had to comment out all the (aspnetcore.dll) references:

  1. (configSections) < section name="aspNetCore" overrideModeDefault="Allow" />

  2. (globalModules) < add name="AspNetCoreModule" image="%IIS_BIN%\aspnetcore.dll" />

  3. (modules) < add name="AspNetCoreModule" lockItem="true" />

You can do a search and comment out accordingly.

Solution 3

Installing the recently released Anniversary Update (version 1607) of Windows 10 seems to destabilize IIS by shutting down Application Pools, thus resulting in a 503 error when trying to run an application, which is caused by some DLLs failing to load when the worker process starts.

Check out the Windows Event Viewer (Win+X, V) to see what you need to fix: Open "Windows Logs", then "Application" and look for "Error" level entries with the source "IIS-W3SVC-WP" (may be different if the name of your IIS instance is not the default one). In the details, you will see a short message, like this:

The Module DLL <path-to-DLL> failed to load.  The data is the error.

Depending on your configuration, there may be different DLLs causing this kind of problem and they will occur one by one, so you will need to keep checking the Event Logs and fix the issues until your application properly starts up. To be sure, before every attempt, stop IIS and close IIS Manager.

Here are two specific issues we've experienced so far and how to fix them, but you may bump into completely different ones:

1."C:\WINDOWS\system32\inetsrv\rewrite.dll" (reference) ◦Go to "Programs and Features" (Win+X, F) and repair "IIS URL Rewrite Module 2".

2."C:\WINDOWS\system32\inetsrv\aspnetcore.dll" (reference) ◦Go to "Programs and Features" (Win+X, F) and repair "Microsoft .NET Core 1.0.0 - VS 2015 Tooling ...".

Original source

Solution 4

For anyone coming to this later, what worked for me was this:

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.1&tabs=aspnetcore1x

I had to install the hosting runtime for aspnetcore (my team's using core) and that fixed my local IIS issues.

Solution 5

Deleting the applicationhost.config did not work for me.

My service was forced to run in 32bit mode, and my aspnetcore was 64 bit.

Since I'm currently not using .NET core I could comment out all references to aspnetcore in the applicationhost.config file and then restart iis.

Share:
18,980

Related videos on Youtube

BattlFrog
Author by

BattlFrog

I've been coding for a couple years, mainly line of business stuff. My main passion is providing data solutions to co-workers so they can be more efficient.

Updated on June 04, 2022

Comments

  • BattlFrog
    BattlFrog almost 2 years

    I usually dev on a windows 7 desktop, using visual studio 2015 update 3. I have the same vs2015.3 on my windows 10 laptop. I copied an asp mvc 5 app I am working on to the laptop but it wont run when I try to launch it from VS. I get the "aspnetcore.dll failed to load" error. I looked around and most solutions are to repair the asp net core install, but my laptop does not have asp net core installed on it, because I don't use core yet. My project is targeting .Net 4.6.

    My desktop does have Core on it. So do I have to install .net core just because? Or is there some other solution? I am using the default IIS 10.

    • Tseng
      Tseng over 7 years
      You still need .NET Core and the Visual Studio Tooling from www.microsoft.com/net/core#windows as they install the dotnet-cli tools which are required to build and run (ASP).NET Core applications
    • BattlFrog
      BattlFrog over 7 years
      Even if I am not building any .net core apps?
  • dynamiclynk
    dynamiclynk about 5 years
    This should be the accepted answer in lieu of editing your host config. Download the hosting bundle from here. dotnet.microsoft.com/download/thank-you/…