添加Web引用时出现Newtonsoft.Json错误

时间:2015-07-24 05:24:46

标签: asp.net visual-studio-2013 json.net web-reference

我在我的网站上添加了一个Web引用。参考添加成功。但是当我在我的网页中添加命名空间时,它会给我以下错误。

Error   22  Reference.svcmap: 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. App_WebReferences/FaxService/ 

我提供给我的网络参考的名称空间名称是" FaxService"。

在pages.aspx.cs页面中,我添加了

using FaxService;

我尝试了什么。

1)删除了网络参考并重新添加。

2)更新网络推荐

3)从" Pakage Manager Console"卸载newton soft。并从我的解决方案中删除了所有的newtonsoft dll。

PM> UnInstall-Package Newtonsoft.Json

4)通过" Pakage Manager Console"再次安装牛顿软件。

PM> Install-Package Newtonsoft.Json

5)在web.config中添加以下行

 <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
  </dependentAssembly>
</assemblyBinding>

不会新添加此Web引用。之前工作正常。

1 个答案:

答案 0 :(得分:0)

错误说关于Version = 6.0.0.0,试着找到它的引用位置?但是您的web.config使用7.0.0.0。尝试找到对6.0.0.0的引用并将其删除。

我的想法是: - 也许其中一个依赖项已更新,现在无法加载? - 在部署之前使用选项“DELETE ALL”,可能在部署目录中存在旧的东西。