5

I'm trying to port over an application I wrote in .NET Core to .NET Core (Targeting .NET Framework), due to the inability to impersonate in Core [from my previous SO].

I created the application and ported over all my Views, Controller, and Models, and implemented the WebClient like I needed to. It runs perfectly fine on my IIS Express locally, but when I publish to IIS I get the error:

FileLoadException: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

There are several StackOverflow threads and solutions, but they're all designed for .NET Core 1.0.1 with the project.json setup, and they don't translate well to csproj. Has anyone encountered this error before?

Full stack trace:

System.IO.FileLoadException: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at TIM.MVC.NET.Startup.ConfigureServices(IServiceCollection services)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

I have tried setting my Application Pool to both No Managed Code and CLR 4.0, neither has any impact on the error that appears. I also tried running

Install-Packem System.Runtime

and that didn't do anything. I can see the System.Runtime.dll file in the ref folder on the server where IIS is hosted, and like I said it works when I run the application in debug with no issues. Thoughts?

Community
  • 1
  • 1
Robert McCoy
  • 661
  • 1
  • 10
  • 19

0 Answers0