【发布时间】:2014-05-19 06:36:37
【问题描述】:
我的配置中有以下内容:
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="Exception Development">
<listeners>
<add name="Database Trace Listener"
formatter="Text Formatter"
traceoutputoptions="LogicalOperationStack, DateTime,
Timestamp, ProcessId, ThreadId, Callstack"
databaseinstancename="LoggingConnectionString"
writelogstoredprocname="WriteLog"
addcategorystoredprocname="AddCategory"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.
FormattedDatabaseTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging.Database,
Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerdatatype="Microsoft.Practices.EnterpriseLibrary.Logging.
Database.Configuration.FormattedDatabaseTraceListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging.Database,
Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
点击这行代码时:ExceptionPolicy.HandleException(exception, policyName);
它会抛出以下异常:
Missing TraceListenerData type in configuration 'listenerdatatype="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData,Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"'.
我不太确定如何将异常记录到数据库中(我还没有完全创建 writeLogStoredProcName 或 addCategoryStoredProcName 中的任何存储过程(我想是吗?我什至不知道应该放什么列)
我所有的 EnterpriseLibrary dll 都来自 EntLib 5.0。我可能做错了什么? (我什至将它们包含在 References 文件夹中。
编辑:
我已经包含了以下 dll:
Microsoft.Practices.EnterpriseLibrary.Common;
Microsoft.Practices.EnterpriseLibrary.Data;
Microsoft.Practices.EnterpriseLibrary.Data.SqlCe;
Microsoft.Practices.EnterpriseLibrary.Logging;
Microsoft.Practices.EnterpriseLibrary.Logging.Database;
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging;
还是没有运气!!
【问题讨论】:
标签: c# database logging exception-handling enterprise-library