Logging 使用MS企业库进行日志记录
我在类库中使用MS Enterprise Library 4.1版。在app.config文件中,我在配置文件中插入了“loggingConfiguration”和“exceptionHandling”的相应条目。但是,它会导致崩溃,即“在配置源中找不到用于日志记录的配置部分。” 配置部分Logging 使用MS企业库进行日志记录,logging,enterprise-library,app-config,Logging,Enterprise Library,App Config,我在类库中使用MS Enterprise Library 4.1版。在app.config文件中,我在配置文件中插入了“loggingConfiguration”和“exceptionHandling”的相应条目。但是,它会导致崩溃,即“在配置源中找不到用于日志记录的配置部分。” 配置部分 <configSections> <section name="loggingConfiguration" type="Microsoft.Practic
<configSections>
<section name="loggingConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging,
Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<section name="exceptionHandling"
type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling,
Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
正如错误所说,您还需要在配置部分中链接它们(仅输入loggingConfiguration和exceptionHandling节点是不行的)
我发现非常有用的也有相同的错误信息。我的问题是我引用了Microsoft.Practices.EnterpriseLibrary.Logging的两个不同版本
我引用的是4.1.0.0,但配置文件版本指向5.0.414.0。在项目中还混合了库的版本。我已经在configSection中进行了链接。更详细地说,我正在一个(WCF RIA服务的web类库)中做日志记录,这个项目的引用在web项目中使用。