NHibernate 3.3 和 SysCache [英] NHibernate 3.3 and SysCache

查看:10
本文介绍了NHibernate 3.3 和 SysCache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

The current version of SysCache does not appear to work with NHibernate 3.3. I replaced the NHibernate dlls in my web/bin directory and left the SysCache dll (which works with 3.2) untouched. Now when IIS tries to do a pre-bind it loads the SysCache dll and tries to bind it to NHibernate 3.2.0.4000 and fails.

[FileLoadException: 无法加载文件或程序集 'NHibernate,版本=3.2.0.4000,文化=中性,PublicKeyToken=aa95f207798dfdb4'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT 的例外:0x80131040)] System.RuntimeTypeHandle.GetTypeByName(字符串名称,布尔throwOnError,布尔ignoreCase,布尔reflectionOnly,StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName,ObjectHandleOnStack 类型) +0
System.RuntimeTypeHandle.GetTypeByName(字符串名称,布尔值throwOnError, Boolean ignoreCase, BooleanreflectionOnly,StackCrawlMark&stackMark, Boolean loadTypeFromPartialName) +95
System.RuntimeType.GetType(String typeName, Boolean throwOnError,布尔忽略大小写,布尔反射,StackCrawlMark&堆栈标记)+54 System.Type.GetType(String typeName) +50 NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName名称,布尔值 throwOnError) +338
NHibernate.Cfg.SettingsFactory.CreateCacheProvider(IDictionary`2属性)+175

[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: 无法实例化 CacheProvider:NHibernate.Caches.SysCache.SysCacheProvider,NHibernate.Caches.SysCache]
NHibernate.Cfg.SettingsFactory.CreateCacheProvider(IDictionary2属性)+256
NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary
2 属性)+3449 NHibernate.Cfg.Configuration.BuildSettings() +29 NHibernate.Cfg.Configuration.BuildSessionFactory() +44

[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 中的配置,一切都很好:

If I comment out the configuration in the web.config all is well:

<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 Contrib 的 NHibernate 缓存下载站点没有最新版本的下载.

The download site for NHibernate caches at NHibernate Contrib does not have a download for the latest version.

推荐答案

问题可能是 SysCache Dll 是使用 NHibernate 3.2.0 构建的,它与 NHibernate 3.3.0 不兼容.解决此问题的一种简单方法是仅从 https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/NHibernate.Caches更新 NHibernate 参考以使用您正在使用的版本,然后重建并使用最新的缓存 dll.由于它是一个小升级,不应该需要任何代码更改,你应该是安全的.

The issue probably is that the SysCache Dll is built using NHibernate 3.2.0 and it is not compatible with NHibernate 3.3.0. An easy way around this is to checkout the trunk of the nhibernate config project or the Cache solution only from https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/NHibernate.Caches update the NHibernate reference to use the version that you are using and then rebuild and use the latest cache dlls. Since its a minor upgrade there shouldnt be any code changes required and you should be safe.

尝试一下,告诉我进展如何.

Try it and let me know how it goes.

这篇关于NHibernate 3.3 和 SysCache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆