【问题标题】:iis hosting. Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0iis 托管。无法加载文件或程序集'Newtonsoft.Json,版本 = 4.5.0.0
【发布时间】:2014-11-14 15:22:54
【问题描述】:

我有一个在开发人员机器上运行良好的 asp.net MVC 4 Web 应用程序(我已将它托管在 IIS 中)。但是在托管到另一台没有安装 mvc 框架和 .net 框架的机器上之后,我最终得到了以下

Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified

我知道mvc框架不需要托管,从下面的链接

Do I need to install MVC 3/4 on web server to run mvc application

【问题讨论】:

  • 确保您的 dll 中的 Newtonsoft.Json 版本正确
  • @MokshShah 我在 bin 文件夹中没有 Newtonsoft.Json dll,但正如我提到的,它在 IIS 中托管后在开发人员系统中工作
  • 你在用吗?那么它必须在您的 bin/debug 文件夹中。最好的办法是,转到引用的项目并检查它的引用位置,并从该路径获取副本并将其放入您的 bin 文件夹中(在另一台不工作的机器中)
  • @MokshShah 我没有在我的项目中的任何地方使用它,我认为它是 mvc 的默认 json 序列化程序

标签: c# asp.net asp.net-mvc iis hosting


【解决方案1】:

不,它不是默认的,在您的项目引用中验证一次,它必须被引用。 Newtonsoft 是第三方库,因此默认情况下它在项目中没有,浏览所有项目的引用并查找 Newtongsoft.Json,一旦找到删除它或者如果您正在使用包然后转到您的 package.config 文件并查找 Newtonsoft .Json 并删除它

【讨论】:

  • 我检查了我所有的项目,没有添加 newtonsoft.json 参考
【解决方案2】:

尝试删除 Newtonsoft Json Nuget (uninstall-Package Newtonsoft.Json) 包或

安装 Newtonsoft Json (Install-Package Newtonsoft.Json) 然后卸载它,它可能会工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-04-25
    • 2011-09-04
    • 2015-12-23
    • 2020-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多