【问题标题】:Logging with MS Enterprise Library使用 MS 企业库进行日志记录
【发布时间】:2011-06-28 14:01:02
【问题描述】:

我在我的类库中使用 MS Enterprise Library 4.1 版。在 app.config 文件中,我在配置文件中为“loggingConfiguration”和“exceptionHandling”插入了适当的条目。但是,它会导致崩溃,即“在配置源中找不到 Logging 的配置部分。”

configSections

<configSections> 
    <section name="loggingConfiguration"
             type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSetting‌​s, Microsoft.Practices.EnterpriseLibrary.Logging, 
                   Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 
    <section name="exceptionHandling" 
             type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.Exce‌​ptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, 
                   Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

【问题讨论】:

    标签: logging enterprise-library app-config


    【解决方案1】:

    正如错误所说,您还需要在 configSection 中链接它们(仅输入 loggingConfiguration 和 exceptionHandling 节点是不行的)。

    This MSDN pages has some Hands on Labs 我觉得很有用

    【讨论】:

    • 我已经在 configSection.i.e.
    • 为了详细说明,我在一个(WCF RIA 服务的 web 类库)中进行日志记录,并且这个项目的引用在 web 项目中使用。
    【解决方案2】:

    有同样的错误信息。我的问题是我引用了两个不同版本的 Microsoft.Practices.EnterpriseLibrary.Logging。

    我引用的是 4.1.0.0,但配置文件版本指向 5.0.414.0。在项目中还混合了库的版本。

    【讨论】:

      猜你喜欢
      • 2011-03-22
      • 1970-01-01
      • 1970-01-01
      • 2010-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-12
      • 2011-02-27
      相关资源
      最近更新 更多