简体   繁体   English

无法加载文件或程序集“ Newtonsoft.Json”

[英]Could not load file or assembly 'Newtonsoft.Json'

I am using Nhibernate in my MVC3 site. 我在MVC3网站中使用Nhibernate。 I have 4 tables in database and a service which is used by the site to get data from database. 我在数据库中有4个表,该网站使用了一项服务来从数据库中获取数据。 Now I am getting this error : 现在我收到此错误:

Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. 无法加载文件或程序集“ Newtonsoft.Json,版本= 3.5.0.0,区域性=中性,PublicKeyToken = 30ad4fe6b2a6aeed”或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 找到的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040) (来自HRESULT的异常:0x80131040)

I found out that by installing the Newtonsoft.Json by NuGet instead of adding reference to its dll solves the problem, so I did that and it solved the problem. 我发现通过安装NuGet的Newtonsoft.Json而不是添加对其dll的引用可以解决此问题,因此我做到了,它解决了问题。 When i debug all works fine. 当我调试一切正常。 But when I publish and upload on my staging server, it gives the error I mentioned above. 但是,当我在登台服务器上发布并上载时,会出现我上面提到的错误。

Also, please note that I have 3 methods in my service, but only one gives the error, rest all works fine. 另外,请注意,我的服务中有3种方法,但是只有一种给出错误,其余所有方法都可以正常工作。 And even that one method works fine locally. 甚至那一种方法在本地也行得通。 Just cannot on staging. 只是不能上演。

Edit: Now i uninstall the Newtonsoft.Json by NuGet and then i added reference to Newtonsoft.Json dll kept in the Bin folder of the Project. 编辑:现在,我通过NuGet卸载Newtonsoft.Json,然后添加对保留在项目Bin文件夹中的Newtonsoft.Json dll的引用。 Again its working locally but not on server. 再次在本地工作,但不在服务器上工作。

Why so? 为什么这样?

Please reply. 请回复。

Thanks. 谢谢。

If it works on your system locally, but does not work on the server. 如果它在本地系统上运行,但在服务器上不运行。 I would assume you have some library installed on your PC that is not available on your server. 我假设您在PC上安装了某些库,而该库在服务器上不可用。

What library could be missing is hard to say, try looking at the references in your project and see if you are referencing libraries that might be using libraries that you have installed locally. 很难说缺少什么库,请尝试查看项目中的引用,看看是否引用的库可能正在使用本地安装的库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集“newtonsoft.json” - could not load file or assembly 'newtonsoft.json' 无法加载文件或程序集Newtonsoft.json版本6.0.0.0 - Could not load file or assembly Newtonsoft.json Version 6.0.0.0 无法在特定计算机上加载文件或程序集“ Newtonsoft.Json” - Could not load file or assembly 'Newtonsoft.Json' on specific machine 无法加载文件或程序集“Newtonsoft.Json”或其依赖项之一 - Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies Newtonsoft.Json版本8.0.2无法加载文件或程序集错误 - Newtonsoft.Json version 8.0.2 Could not load file or assembly Error 无法加载文件或程序集 'Newtonsoft.Json,版本 = 12.0.0.0? - Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0? 无法加载文件或程序集 'Newtonsoft.Json,版本 = 10.0.0.0 - Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0 无法加载文件或程序集 'Newtonsoft.Json,版本 = 7.0.0.0 - Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0 Azure Function:无法加载文件或程序集 Newtonsoft.Json - Azure Function: Could not load file or assembly Newtonsoft.Json 无法加载文件或程序集“ Newtonsoft.Json”或其依赖项之一? - Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM