"尝试获取类型日志写,关键和QUOT的实例激活出错; [英] Activation error occured while trying to get instance of type LogWriter, key ""

查看:237
本文介绍了"尝试获取类型日志写,关键和QUOT的实例激活出错;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我在洛到事件查看器收到此错误。我looging在事件查看器异常以及滚动平面文件。如果删除了事件查看器部分,然后滚动平面文件完美的作品,但只有当我添加此它给人的例外


  

{依赖解析失败,键入=
  \\Microsoft.P​​ractices.EnterpriseLibrary.Logging.LogWriter \\,名字=
  \\(无)\\\\而发生r \\ n异常:在解析\\ r \\ n异常
  是:出现InvalidOperationException - 类型的TraceListener不能
  建。您必须配置容器提供此
  值。\\ r \\ n -------------------------------------------- --- \\ r \\的NAT
  例外的时候,容器是:\\ r \\ n \\ r \\ n解决
  Microsoft.P​​ractices.EnterpriseLibrary.Logging.LogWriterImpl,日志写默认
  (从Microsoft.P​​ractices.EnterpriseLibrary.Logging.LogWriter映射,
  (无))\\ r \\ n解决参数\\structureHolder \\构造
  Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl(Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder
  structureHolder,
  Microsoft.P​​ractices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider
  instrumentationProvider,
  Microsoft.P​​ractices.EnterpriseLibrary.Logging.ILoggingUpdateCoordinator
  updateCoordinator)\\ r \\ n解决
  Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder,LogWriterStructureHolder.default
  (从映射
  Microsoft.P​​ractices.EnterpriseLibrary.Logging.LogWriterStructureHolder,
  构造函数(无))\\ r \\ n解决参数\\tr​​aceSources \\
  Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder(System.Collections.Generic.IEnumerable<$c$c>1[[Microsoft.Practices.EnterpriseLibrary.Logging.Filters.ILogFilter,
  Microsoft.P​​ractices.EnterpriseLibrary.Logging,版本= 5.0.414.0,
  文化=中性公钥= 31bf3856ad364e35]过滤器,
  System.Collections.Generic.IEnumerable 1 [System.String,mscorlib中,
  版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089]
  traceSourceNames,
  System.Collections.Generic.IEnumerable<$c$c>1[[Microsoft.Practices.EnterpriseLibrary.Logging.LogSource,
  Microsoft.P​​ractices.EnterpriseLibrary.Logging,版本= 5.0.414.0,
  文化=中性公钥= 31bf3856ad364e35] traceSources,
  Microsoft.P​​ractices.EnterpriseLibrary.Logging.LogSource
  allEventsTraceSource,
  Microsoft.P​​ractices.EnterpriseLibrary.Logging.LogSource
  notProcessedTraceSource,
  Microsoft.P​​ractices.EnterpriseLibrary.Logging.LogSource
  errorsTraceSource,System.String defaultCategory,System.Boolean
  tracingEnabled,System.Boolean logWarningsWhenNoCategoriesMatch,
  System.Boolean revertImpersonation)\\ r \\ n解决
  Microsoft.P​​ractices.EnterpriseLibrary.Logging.LogSource,一般\\ r \\ n结果
  解决参数\\tr​​aceListeners \\构造
  Microsoft.P​​ractices.EnterpriseLibrary.Logging.LogSource(System.String
  名称,
  System.Collections.Generic.IEnumerable 1 [System.Diagnostics.TraceListener,
  系统,版本= 4.0.0.0,文化=中立,
  公钥= b77a5c561934e089] traceListeners,
  System.Diagnostics.SourceLevels水平,System.Boolean自动冲洗,
  Microsoft.P​​ractices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider
  instrumentationProvider)\\ r \\ n解决
  System.Diagnostics.TraceListener,事件日志跟踪监听器\\ r \\ n}



解决方案

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

I am getting this error while loggin into eventviewer. I am looging the exception in event viewer as well as rolling flat file. If i remove the eventviewer section then rolling flat file works perfectly, but only when i add this it gives the exception

{"Resolution of the dependency failed, type = \"Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter\", name = \"(none)\".\r\nException occurred while: while resolving.\r\nException is: InvalidOperationException - The type TraceListener cannot be constructed. You must configure the container to supply this value.\r\n-----------------------------------------------\r\nAt the time of the exception, the container was:\r\n\r\n Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl,LogWriter.default (mapped from Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter, (none))\r\n Resolving parameter \"structureHolder\" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl(Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder structureHolder, Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider, Microsoft.Practices.EnterpriseLibrary.Logging.ILoggingUpdateCoordinator updateCoordinator)\r\n Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder,LogWriterStructureHolder.default (mapped from Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder, (none))\r\n Resolving parameter \"traceSources\" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder(System.Collections.Generic.IEnumerable1[[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.IEnumerable1[[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
1[[System.Diagnostics.TraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] traceListeners, System.Diagnostics.SourceLevels level, System.Boolean autoFlush, Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider)\r\n Resolving System.Diagnostics.TraceListener,Event Log Trace Listener\r\n"}

解决方案

I had the same problem and it was due to an error in my configuration file. I referenced trace listeners from my categorySources section which did not exist in my listeners section. I removed the categories and the mappings (i did not use them anyway) and then it worked. I guess you can validate your configuration file in the configuration console and then it will tell you what the problem is.

这篇关于&QUOT;尝试获取类型日志写,关键和QUOT的实例激活出错;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆