【发布时间】:2016-10-01 01:10:34
【问题描述】:
我创建了一个新的 Service Fabric 应用程序来使用 Owin Self-host 托管 WebAPI 服务。
我将服务项目的所有 nuget 包更新到最新版本,现在当我尝试启动应用程序时出现以下错误:
无法加载文件或程序集 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' 或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。 (HRESULT 异常:0x80131040)
在 App.config 中正确设置绑定重定向以重定向到最新版本的 Newtonsoft.Json。
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
我需要更新到最新版本的原因是由于其他依赖于更新版本的 Owin 和 Newtonsoft.Json。
这是 Service Fabric 与 Owin 结合的一些已知限制吗?
【问题讨论】:
-
Azure Service Fabric 不应要求提供 Newtonsoft。猜猜你在 OWIN 中间件的某个地方使用它。如果您打开无法加载程序集的项目的引用并找到 Newtonsoft.Json,那么为特定版本属性设置了什么值?
标签: json.net asp.net-web-api2 owin azure-service-fabric