我想用MemCache配置Fluent NHibernate,但出现以下错误。我使用MVC5 + CastleWindsor + FluentNHibernate + UOW用NHibernate.Caches.MemCached配置Fluent Nhibernate
private static ISessionFactory CreateNhSessionFactory() { var connStr = System.Configuration.ConfigurationManager.ConnectionStrings["AESConnect"].ConnectionString; return Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008.ConnectionString(connStr)) .Cache(c=>c.ProviderClass(typeof(NHibernate.Caches.MemCache.MemCacheProvider).AssemblyQualifiedName).UseSecondLevelCache()) .ExposeConfiguration(e=>e.SetProperty("hibernate.cache.use_second_level_cache","true")) .Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetAssembly(typeof(HotelsMap)))) .BuildSessionFactory(); }
错误:
[NullReferenceException: Object reference not set to an instance of an object.] Memcached.ClientLibrary.SockIOPool.Initialize() in C:\devroot\memcacheddotnet\trunk\clientlib\src\clientlib\SockIOPool.cs:441 NHibernate.Caches.MemCache.MemCacheProvider.Start(IDictionary`2 properties) +3627
NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) +1098
NHibernate.Cfg.Configuration.BuildSessionFactory() +181
FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() +73[FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
] FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() +117 AESRepositories.Installers.AESInstaller.CreateNhSessionFactory() ....
在此先感谢
谢谢你的回应。我觉得我错过了我的设置中的一大步。我没有看到SockIOPool.cs文件。所以我会找出我缺少的东西,我会在这里回复。再次感谢您的回复,请收藏本文:)我将很快提出一些问题:)谢谢。 – user3634311