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...
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=188.8.131.52, 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:
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
Now, I take that to mean, "Clear out the binaries.. wherever they may be"
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:
Simply stop debugging and go to the
Manage NuGet Packages for Solution and search for that package in the installed tab:
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.
This is a common issue when mixing 1.1.0 and 1.1.1 asp.net 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.
User contributions licensed under CC BY-SA 3.0