首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >C# Microsoft.Practices.EnterpriseLibrary.Logging错误

C# Microsoft.Practices.EnterpriseLibrary.Logging错误
EN

Stack Overflow用户
提问于 2011-09-13 17:36:53
回答 1查看 4.4K关注 0票数 3

我在尝试使用Microsoft.Practices.EnterpriseLibrary.Logging时遇到错误

'Microsoft.Practices.EnterpriseLibrary.Logging.Logger‘的类型初始值设定项引发异常。

代码语言:javascript
复制
<configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null" />
  </configSections>
  <loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="Tracing" logWarningsWhenNoCategoriesMatch="true">
    <listeners>
      <add fileName="F:\Service\Service\log\Full\Service.log" rollSizeKB="1024" timeStampPattern="yyyy-MM-dd" rollFileExistsBehavior="Increment" rollInterval="None" formatter="Text Formatter" header="" footer="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null" traceOutputOptions="LogicalOperationStack" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null" name="AppLog" />
     </listeners>
    <formatters>
      <add template="{timestamp} : {message}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null" name="Text Formatter" />
    </formatters>
    <categorySources>
      <add switchValue="All" name="AppLog">
        <listeners>
          <add name="AppLog" />
        </listeners>
      </add>
      <add switchValue="Verbose" name="ExceptionHandling">
        <listeners>
          <add name="Exception" />
        </listeners>
      </add>
      <add switchValue="Information" name="Tracing">
        <listeners>
          <add name="Trace" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category" />
      <errors switchValue="Off" name="Logging Errors  Warnings" />
    </specialSources>
  </loggingConfiguration>

任何帮助我们都将不胜感激。

谢谢

K

EN

回答 1

Stack Overflow用户

发布于 2016-11-15 17:04:15

我遇到了这个问题,在花了很长时间之后,如果发现在我的配置中,声明"configSection“应该是第一个标签。如果在它之前有任何其他标记,那么它会抛出相同的错误。

在我的例子中,我的configsection之前有一个目标框架标签。我把它移到那之后,它就开始工作了

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7399707

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档