'仅在通过 Internet 调用 WCF REST 方法时无法加载文件或程序集 'Newtonsoft.Json, Version=6.0.0.0' 错误
'Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0' error only when calling WCF REST method via the Internet
在我们的 SharePoint 2013 开发机中,我有一个可以通过 class 库访问的 WCF Rest Web 服务。 class 库已通过 nuget.org(包管理器控制台)成功安装了 'Newtonsoft.Json 6.0.5'。解决方案构建没有任何问题。
我的 SharePoint 站点有 2 种连接方式:
- Local Network:以这种方式访问时,WCF REST 方法调用可以顺利进行。我也得到了正确的结果。
- Internet 访问:我们有替代访问映射,当调用 WCF Rest 方法时,出现以下错误:
Message: 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.
注意: Web application/bin 文件夹具有正确的 .dll 版本 (6.0.5.17707)
我错过了什么吗?
找到解决方案:
我扩展了我的 Web 应用程序以映射到 Internet(替代访问映射),这意味着我有一个用于新端口的新 bin 文件夹。一旦我将 Dll 复制并粘贴到新的 bin 中。错误消失了。
在我们的 SharePoint 2013 开发机中,我有一个可以通过 class 库访问的 WCF Rest Web 服务。 class 库已通过 nuget.org(包管理器控制台)成功安装了 'Newtonsoft.Json 6.0.5'。解决方案构建没有任何问题。
我的 SharePoint 站点有 2 种连接方式:
- Local Network:以这种方式访问时,WCF REST 方法调用可以顺利进行。我也得到了正确的结果。
- Internet 访问:我们有替代访问映射,当调用 WCF Rest 方法时,出现以下错误:
Message: 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.
注意: Web application/bin 文件夹具有正确的 .dll 版本 (6.0.5.17707)
我错过了什么吗?
找到解决方案:
我扩展了我的 Web 应用程序以映射到 Internet(替代访问映射),这意味着我有一个用于新端口的新 bin 文件夹。一旦我将 Dll 复制并粘贴到新的 bin 中。错误消失了。