C# CacheManager.Serialization.Json“;无法加载文件或程序集';Newtonsoft.Json,版本=8.0.0.0“;

C# CacheManager.Serialization.Json“;无法加载文件或程序集';Newtonsoft.Json,版本=8.0.0.0“;,c#,json,cachemanager,C#,Json,Cachemanager,我计划使用CacheManager(),并一直尝试将其设置为与CacheManager.Serialization.Json一起使用。它需要Newtonsoft.Json(>=8.0.3) 我已经通过NuGet安装了Newtonsoft.Json 9.0.1。这是我的web.config的摘录 <cache name="redisWithBackplane" updateMode="Up" enableStatistics="false" enablePerforman

我计划使用CacheManager(),并一直尝试将其设置为与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" />
<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>

并在同一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" />
<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,Version=8.0.0.0”,一旦我将Newtonsoft.Json替换为Version 8.0.0,它就开始工作了。绑定重定向似乎没有任何效果。任何想法。有什么问题吗?

您写道,您使用的是Json.Net 9.0.1,而绑定重定向是9.0.0.0

也许您应该将重定向修复为9.0.1.0(我假设它尝试加载8.0.0,然后找到绑定重定向,尝试加载最新的重定向,但在9.0.0.0之前不存在)


另外,我不确定语法和1的位置,因此您可以尝试使用10.0.0.0,例如,以排除该问题。

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

也许您应该将重定向修复为9.0.1.0(我假设它尝试加载8.0.0,然后找到绑定重定向,尝试加载最新的重定向,但在9.0.0.0之前不存在)


另外,我不确定1的语法和放置位置,因此您可以尝试使用10.0.0.0,例如,以排除该问题。

Argh。问题是根标签。我有一个关于继承的应用程序。有一次我把它改成了正常工作。尽管VS2010抱怨InheritInChildApplication无效,但它仍然可以正常工作,已经在研究它,无法复制它^^Argh。问题是根标签。我有一个关于继承的应用程序。有一次我把它改成了正常工作。尽管VS2010抱怨InheritInChildApplication无效,但它仍然可以正常工作,已经在研究它并且无法复制它^^^ 9.0.1的程序集版本仍然是9.0.0.0,因此没有,重定向完全正确。您也可以检查此线程:。根据第二个答案,例如,如果您在配置中有名称空间,则可以忽略绑定重定向。例如,9.0.1的汇编版本仍然是9.0.0.0,因此不,重定向完全正确。您也可以检查此线程:。根据第二个答案,例如,如果配置上有名称空间,则可以忽略绑定重定向。