aspnetcore.dll failed to load

女生的网名这么多〃 提交于 2019-12-05 01:41:14
BattlFrog

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?

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

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!