2016-11-14 100 views
1

我打算使用CacheManager(http://cachemanager.michaco.net/)並試圖將其設置爲與CacheManager.Serialization配合使用。 JSON。它需要Newtonsoft.Json(> = 8.0.3)。CacheManager.Serialization.Json「無法加載文件或程序集'Newtonsoft.Json,版本= 8.0.0.0」

我已經通過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> 

我收到提示「無法加載文件或程序集Newtonsoft綁定重定向。 Json,版本= 8.0.0.0「,並且一旦我將Newtonsoft.Json替換爲版本8.0.0,它就開始工作。綁定重定向似乎沒有任何效果。任何想法。什麼可能是錯的?

+0

Argh。問題是根標籤。我將它作爲用於inheritInChildApplications。一旦我將它改爲就行了。雖然VS2010抱怨無效inheritInChildApplications它仍然有效 –

+0

酷,已經看着它,不能再現它^^ – MichaC

回答

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只是爲了排除這個問題。

+0

9.0.1的程序集版本仍然是9.0.0.0,所以不,重定向是完全正確 – MichaC

+0

您可以檢查此線程以及:http://stackoverflow.com/questions/22507189/could-not-load-file-or-assembly-newtonsoft-json-version-4-5-0-0-culture-neutr。根據第二個答案,例如如果在配置上有命名空間,則可以忽略綁定重定向。 –

相關問題