CacheManager.Serialization.Json"无法加载文件或程序集' Newtonsoft.Json,Version = 8.0.0.0"

时间:2016-11-14 10:14:08

标签: c# json cachemanager

我计划使用CacheManager(http://cachemanager.michaco.net/),并一直试图将其设置为与CacheManager.Serialization.Json一起使用。它需要Newtonsoft.Json(> = 8.0.3)。

我通过NuGet安装了Newtonsoft.Json 9.0.1。这是我的web.config

的摘录
<cache name="redisWithBackplane" updateMode="Up" enableStatistics="false" 
         enablePerformanceCounters="false" backplaneName="localRedis" backplaneType="CacheManager.Redis.RedisCacheBackplane, CacheManager.StackExchange.Redis" 
         serializerType="CacheManager.Serialization.Json.JsonCacheSerializer, CacheManager.Serialization.Json">
<handle name="localRedis" ref="redisHandle" expirationMode="None" timeout="50s" isBackplaneSource="true" />

和绑定重定向在同一个web.config

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
    </dependentAssembly>
</assemblyBinding>

我收到错误&#34;无法加载文件或程序集&#39; Newtonsoft.Json,Version = 8.0.0.0&#34;一旦我将Newtonsoft.Json替换为8.0.0版本,它就开始工作了。绑定重定向似乎没有任何影响。任何的想法。可能有什么不对?

1 个答案:

答案 0 :(得分:0)

你写道你有Json.Net 9.0.1,而绑定重定向是9.0.0.0。

也许您应该将重定向修复为9.0.1.0(我想它会尝试加载8.0.0,然后找到绑定重定向,尝试加载最新版本,但最多只能加载到9.0.0.0)。

P.S。我不确定语法和放置1的位置,因此您可以尝试使用10.0.0.0,例如只是为了排除这个问题。