gpt4 book ai didi

NHibernate 3.3 和 SysCache

转载 作者:行者123 更新时间:2023-12-03 14:36:54 24 4
gpt4 key购买 nike

当前版本的 SysCache 似乎不适用于 NHibernate 3.3。我替换了我的 web/bin 目录中的 NHibernate dll,并保持 SysCache dll(适用于 3.2)不变。现在,当 IIS 尝试进行预绑定(bind)时,它会加载 SysCache dll 并尝试将其绑定(bind)到 NHibernate 3.2.0.4000 并失败。

[FileLoadException: Could not load file or assembly 'NHibernate, Version=3.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +95
System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +54 System.Type.GetType(String typeName) +50 NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, Boolean throwOnError) +338
NHibernate.Cfg.SettingsFactory.CreateCacheProvider(IDictionary`2 properties) +175

[HibernateException: could not instantiate CacheProvider: NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache]
NHibernate.Cfg.SettingsFactory.CreateCacheProvider(IDictionary2
properties) +256

NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary
2 properties) +3449 NHibernate.Cfg.Configuration.BuildSettings() +29 NHibernate.Cfg.Configuration.BuildSessionFactory() +44



如果我注释掉 web.config 中的配置,一切都很好:
<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache" >true</property>
<property name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache</property>

NHibernate 缓存的下载站点位于 NHibernate Contrib没有最新版本的下载。

最佳答案

一种不同且稍微简单的方法是覆盖对 3.2 的引用。您的 web.config 中的 NHibernate 版本或 app.config引用所需版本3.3像这样:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NHibernate" culture="neutral" publicKeyToken="aa95f207798dfdb4" />
<bindingRedirect newVersion="3.3.0.4000" oldVersion="0.0.0.0-3.3.0.4000" />
</dependentAssembly>
</assemblyBinding>
</runtime>

我自己刚刚尝试过,它按预期工作。

关于NHibernate 3.3 和 SysCache,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10491876/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com