Log4Net.Async ASP.NET MVC 中的问题
Log4Net.Async issue in ASP.NET MVC
我不断收到以下错误:
log4net:ERROR Could not create Appender [AsyncLog4NetAppender] of type [Log4Net.Async.ParallelForwardingAppender]. Reported error follows.
System.TypeLoadException: Could not load type [Log4Net.Async.ParallelForwardingAppender]. Tried assembly [log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a] and all loaded assemblies
at log4net.Util.SystemInfo.GetTypeFromString(Assembly relativeAssembly, String typeName, Boolean throwOnError, Boolean ignoreCase)
at log4net.Util.SystemInfo.GetTypeFromString(String typeName, Boolean throwOnError, Boolean ignoreCase)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)
log4net:ERROR Appender named [AsyncLog4NetAppender] not found.
包配置
<package id="log4net" version="2.0.8" targetFramework="net451" />
<package id="Log4Net.Async" version="2.0.4" targetFramework="net451" />
网络配置
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0"/>
</dependentAssembly>
当我删除 log4net.async
nuget 包并再次添加它时,它起作用了。但是过了一段时间我又遇到了这个错误。
您(可能)需要将程序集名称添加到您的附加程序引用中。
<appender name="AsyncLog4NetAppender" type="Log4Net.Async.ParallelForwardingAppender,Log4Net.Async">
注意逗号后面的部分,Log4Net.Async
。
添加引用程序集的名称应该告诉 .Net 如何在适当的程序集中找到 class。
我不断收到以下错误:
log4net:ERROR Could not create Appender [AsyncLog4NetAppender] of type [Log4Net.Async.ParallelForwardingAppender]. Reported error follows.
System.TypeLoadException: Could not load type [Log4Net.Async.ParallelForwardingAppender]. Tried assembly [log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a] and all loaded assemblies
at log4net.Util.SystemInfo.GetTypeFromString(Assembly relativeAssembly, String typeName, Boolean throwOnError, Boolean ignoreCase)
at log4net.Util.SystemInfo.GetTypeFromString(String typeName, Boolean throwOnError, Boolean ignoreCase)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)
log4net:ERROR Appender named [AsyncLog4NetAppender] not found.
包配置
<package id="log4net" version="2.0.8" targetFramework="net451" />
<package id="Log4Net.Async" version="2.0.4" targetFramework="net451" />
网络配置
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0"/>
</dependentAssembly>
当我删除 log4net.async
nuget 包并再次添加它时,它起作用了。但是过了一段时间我又遇到了这个错误。
您(可能)需要将程序集名称添加到您的附加程序引用中。
<appender name="AsyncLog4NetAppender" type="Log4Net.Async.ParallelForwardingAppender,Log4Net.Async">
注意逗号后面的部分,Log4Net.Async
。
添加引用程序集的名称应该告诉 .Net 如何在适当的程序集中找到 class。