Kestrel fail: Can not load Microsoft.Extensions.Logging.Abstractions


I had a very simple Kestrel / ASP.NET Core project successfully deployed to my Windows 2008 R2 server.. (started with an empty Web project + IdentityServer4 nuget I was following this Getting Started page)

So, I could initially retrieve the 'discovery' JSON document.

Then, (per this guide) I added a couple of NuGet packages to it, some views/CSS, etc...

  • Microsoft.AspNetCore.Mvc -Version 1.1.0
  • Microsoft.ApsNetCore.StaticFiles -Version 1.1.0

The upgraded solution runs fine on my Win7 dev box, but, after redeploying.. Now I get the dreaded 502.5 error page. If I go into the server and try to "jump start" the executable via command line.. I can see this error:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=, Culture=neutral,PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Ross.Web.Applications.Identity.Program.Main(String[] args)

Where did I go wrong?

I can see the aforemetioned DLL, Microsoft.Extensions.Logging.Abstractions, published to the server's file system. I'm guessing I need to do a binding redirect or something, but, I'm too new to core to know how.

After upgrading my NuGet packages to the latest.. the error is similar, but now it can't find: Microsoft.AspNetCore.Hosting.Abstractions, Version=
asked on Stack Overflow May 12, 2017 by bkwdesign • edited May 12, 2017 by bkwdesign

3 Answers


Ok, I had to clear out my server's directory.. and do a fresh redeploy. I had seen other answers about deleteing the 'bin' but was confused, since core web deployments don't feature an actual /bin directory.

Now, I take that to mean, "Clear out the binaries.. wherever they may be"

answered on Stack Overflow May 12, 2017 by bkwdesign

People that have multiple projects in solution, pay attention:

This is mainly because there are multiple projects in your solution, and the mentioned package is installed in both of them but with different versions.

Suppose that the exception is like the following:

enter image description here

Simply stop debugging and go to the Manage NuGet Packages for Solution and search for that package in the installed tab:

enter image description here

As you can see, I have that package in two projects with different versions, and that's the point! Simply update the lower version equal to the higher version and you're all set.

answered on Stack Overflow May 23, 2017 by Amin Saqi • edited Sep 7, 2020 by AndrewGentry

This is a common issue when mixing 1.1.0 and 1.1.1 core dependencies.

The simplest solution is to update all dependencies to 1.1.1. If this isn't possible, then you will need to add a binding redirect to redirect the 1.1.1 dependencies to target 1.1.0 assemblies.

After you change these dependencies or add the binding redirects, clear out you /bin folder locally, and turn clean on your next build.

answered on Stack Overflow May 14, 2017 by kg743

User contributions licensed under CC BY-SA 3.0