核心应用程序(针对.NET Framework) - IIS发布错误“无法加载文件或程序集System.Runtime”

时间:2017-03-01 14:55:58

标签: asp.net asp.net-core

我正在尝试将我在.NET Core中编写的应用程序移植到.NET Core(Targeting .NET Framework),因为无法模拟Core [from my previous SO]。

我创建了应用程序并移植了所有的Views,Controller和Models,并按照我的需要实现了WebClient。它在我的IIS Express本地运行完全正常,但是当我发布到IIS时,我收到错误:

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)

有几个StackOverflow线程和解决方案,但它们都是针对带有project.json设置的.NET Core 1.0.1设计的,并且它们不能很好地转换为csproj。有没有人遇到过这个错误?

完整堆栈跟踪:

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()

我已尝试将我的应用程序池设置为No Managed Code和CLR 4.0,对所出现的错误都没有任何影响。我也尝试过运行

Install-Packem System.Runtime

并没有做任何事情。我可以在托管IIS的服务器上的ref文件夹中看到System.Runtime.dll文件,就像我说的那样,当我在调试中运行应用程序时没有任何问题。想法?

0 个答案:

没有答案