我在我的类库中使用 MS Enterprise Library 4.1 版。在 app.config 文件中,我在配置文件中插入了“loggingConfiguration”和“exceptionHandling”的适当条目。但是,它会崩溃,即“在配置源中找不到日志记录的配置部分。”
configSections
<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" />
最佳答案
正如错误所示,您还需要在 configSection 中链接它们(仅输入loggingConfiguration和ExceptionHandling节点是不行的)。
关于使用 MS Enterprise Library 进行日志记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6507663/