1

I'm planning on using CacheManager (http://cachemanager.michaco.net/) and has been trying to set it to work with CacheManager.Serialization.Json. It requires Newtonsoft.Json (>= 8.0.3).

I've Newtonsoft.Json 9.0.1 installed via NuGet. This is excerpt of my 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" />

and binding redirect in the same 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>

I'm getting error "Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0" and once I replace Newtonsoft.Json to version 8.0.0, it started working. The binding redirect does not seems to have any effect. Any idea. What could be wrong?

MichaC
  • 13,104
  • 2
  • 44
  • 56
Bruce Chua
  • 31
  • 3
  • Argh. The problem was the root tag . I had it as for inheritInChildApplications. Once I changed it to just it worked. Although VS2010 complained about invalid inheritInChildApplications it still works – Bruce Chua Nov 14 '16 at 11:11
  • Cool, was already looking into it and couldn't reproduce it ^^ – MichaC Nov 14 '16 at 13:54

1 Answers1

0

You wrote that you have Json.Net 9.0.1, while you binding redirect is to 9.0.0.0.

Perhaps you should fix the redirect to 9.0.1.0 (I suppose it tries to load 8.0.0, then find the binding redirect, tries to load the latest, but none exist up to 9.0.0.0).

P.S. I am not sure about the syntax and where to put 1, so you can try with 10.0.0.0 e.g. just to rule out that problem.

Ilya Chernomordik
  • 27,817
  • 27
  • 121
  • 207
  • assembly version of 9.0.1 is still 9.0.0.0, so no, the redirect is totally fine – MichaC Nov 14 '16 at 13:54
  • You can check this thread as well: http://stackoverflow.com/questions/22507189/could-not-load-file-or-assembly-newtonsoft-json-version-4-5-0-0-culture-neutr. According to second answer e.g. the binding redirect can be ignored if you have namespace on config e.g. – Ilya Chernomordik Nov 14 '16 at 13:59