Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logging 使用MS企业库进行日志记录_Logging_Enterprise Library_App Config - Fatal编程技术网

Logging 使用MS企业库进行日志记录

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

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

配置部分

<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" />


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


我发现非常有用的

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


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

我已经在configSection中进行了链接。更详细地说,我正在一个(WCF RIA服务的web类库)中做日志记录,这个项目的引用在web项目中使用。