【问题标题】:Can't get nhibernate config section out though configuration manager通过配置管理器无法获取休眠配置部分
【发布时间】:2009-07-23 20:35:40
【问题描述】:

我正在尝试设置 Memcached 二级缓存。我遵循了我能找到的文档,包括从 SVN 下载项目并查看它在他们的测试项目中是如何配置的,最后在我的 app.config 中得到了这个。

<configuration>
  <configSections>
    <section name="memcache" type="NHibernate.Caches.MemCache.MemCacheSectionHandler,NHibernate.Caches.MemCache" />
  </configSections>
  <memcache>    
    <memcached host="xx.xx.xx.xx" port="11211" weight="10" />
  </memcache>
</configuration>

但是,当NHibernate.Caches.MemCache 中的MemCache 提供程序代码调用configurationmanager.getsection("memcache") 时,会返回null,从而导致出错。

我有三个项目,.UI、.Core 和 .Data - app.config 用于 .UI,.Data 用于构建 SessionFactory 并启动要加载此配置部分的代码。 .Data 有 Nhibernate.Caches.Memcache 引用,我尝试将其添加到 .UI,但这并没有解决问题。

此配置有什么不正确之处?或者也许是关于我的项目的东西?有人对NHibernate.Caches.MemCache 有任何经验吗?通过 Google 找不到太多关于它的信息。

【问题讨论】:

    标签: nhibernate memcached app-config


    【解决方案1】:

    问题最终是我的 app.config 出现了一些损坏。一切都是正确的,但它没有被程序集加载。我删除并重新添加它,然后它工作正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-08
      • 2012-04-18
      • 1970-01-01
      • 1970-01-01
      • 2015-07-28
      • 2016-05-06
      相关资源
      最近更新 更多