gpt4 book ai didi

C# Microsoft.Practices.EnterpriseLibrary.Logging 错误

转载 作者:行者123 更新时间:2023-11-30 17:16:13 24 4
gpt4 key购买 nike

当我尝试使用 Microsoft.Practices.EnterpriseLibrary.Logging 时出现错误

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

<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

最佳答案

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

在我的例子中,在我的配置部分之前有目标框架标签。我将它移到之后,它开始工作了

关于C# Microsoft.Practices.EnterpriseLibrary.Logging 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7399707/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com