升级到Newtonsoft.Json 8.0.2后,我的ASP.NET 5 RC1应用程序出现以下错误,我不知道如何解决。在旧版本下,我们将使用BindingRedirect。我们如何在ASP.NET 的新vNEXT版本中解决此问题
System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)
at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load()
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Add(IConfigurationProvider provider)
at Microsoft.Extensions.Configuration.JsonConfigurationExtensions.AddJsonFile(IConfigurationBuilder configurationBuilder, String path, Boolean optional)
at Microsoft.AspNet.Hosting.WebApplication.Run(Type startupType, String[] args)
at Microsoft.AspNet.Server.Kestrel.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
at Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.<ExecuteMain>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
好的,所以为了解决这个问题,我不得不删除WRAP/Newtonsoft.Json文件夹。显然,安装新版本在WRAP文件夹中为其创建了一个条目。一旦我从那里删除了它,我的应用程序就会再次正常运行。