NHibernate 3.3和SysCache [英] NHibernate 3.3 and SysCache

查看:84
本文介绍了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,布尔反射Only, StackCrawlMarkHandle stackMark,布尔值loadTypeFromPartialName, ObjectHandleOnStack类型)+0
System.RuntimeTypeHandle.GetTypeByName(字符串名称,布尔值 throwOnError,布尔ignoreCase,布尔反射Only, StackCrawlMark& stackMark,布尔型loadTypeFromPartialName)+95
System.RuntimeType.GetType(String typeName,布尔throwOnError, 布尔值ignoreCase,布尔值反射专用,StackCrawlMark& stackMark) +54 System.Type.GetType(字符串类型名称)+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(IDictionary 2 properties) +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天全站免登陆