尝试获取LogWriter类型的实例时出现激活错误,键""

use*_*737 3 asp.net-mvc

登录到eventviewer时,我收到此错误.我在事件查看器中滚动异常以及滚动平面文件.如果我删除eventviewer部分然后滚动平面文件工作完美,但只有当我添加它时,它给出了例外

{"依赖项的解析失败,类型= \"Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter \",name = \"(none)\".\ r \n发生异常时:解析时.\ r \nException是: InvalidOperationException - 无法构造类型TraceListener.您必须配置容器以提供此值.\ r \n --------------------------- --------------------\r \n在异常时,容器是:\ r \n\r \n解析Microsoft.Practices.EnterpriseLibrary.Logging .LogWriterImpl,日志写.默认 (从Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter映射,(无))\ r \n解决参数\ "structureHolder \"构造Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl(Microsoft.Practices的. EnterpriseLibrary.Logging.LogWriterStructureHolder structureHolder,Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider,Microsoft.Practices.EnterpriseLibrary.Logging.ILoggingUpdateCoordinator update 协调员)\ r \n解析Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder,LogWriterStructureHolder.default (从Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder,(无)映射)\ r \n解析构造函数Microsoft的参数\"traceSources \".Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder(System.Collections.Generic.IEnumerable 1[[Microsoft.Practices.EnterpriseLibrary.Logging.Filters.ILogFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] filters, System.Collections.Generic.IEnumerable1 [ [System.String,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089]] traceSourceNames,System.Collections.Generic.IEnumerable 1 [[System.Diagnostics.TraceListener,System,Version = 4.0.0.0,Culture =中性,PublicKeyToken = b77a5c561934e089]] traceListeners,System.Diagnostics.SourceLevels级别,System.Boolean autoFlush,Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider)\ r \n解析System.Diagnostics.TraceListener,事件日志跟踪侦听器\ r \n"个}1[[Microsoft.Practices.EnterpriseLibrary.Logging.LogSource, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] traceSources, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource allEventsTraceSource, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource notProcessedTraceSource, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource errorsTraceSource, System.String defaultCategory, System.Boolean tracingEnabled, System.Boolean logWarningsWhenNoCategoriesMatch, System.Boolean revertImpersonation)\r\n Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogSource,General\r\n
Resolving parameter \"traceListeners\" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogSource(System.String name, System.Collections.Generic.IEnumerable

小智 5

我有同样的问题,这是由于我的配置文件中的错误.我引用了我的categorySources部分中的跟踪侦听器,这些侦听器在我的侦听器部分中不存在.我删除了类别和映射(我没有使用它们)然后它工作.我想你可以在配置控制台中验证你的配置文件,然后它会告诉你问题是什么.