log4net.ext.json:错误找不到类型[log4net.Layout.SerializedLayout,log4net.Ext.Json]

时间:2015-06-09 15:16:54

标签: json log4net log4net-ext-json

我已经为log4net.Ext.Json安装了nuget包,并在wiki之后安装了first steps instructions

但是,我在运行时收到以下错误:

log4net:ERROR Failed to find type [log4net.Layout.SerializedLayout, log4net.Ext.Json]
System.IO.FileNotFoundException: Could not load file or assembly 'log4net.Ext.Json' or one of its dependencies. The system cannot find the file specified.
File name: 'log4net.Ext.Json'
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
   at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
   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.CreateObjectFromXml(XmlElement element, Type defaultTargetType, Type typeConstraint)

=== Pre-bind state information ===
LOG: DisplayName = log4net.Ext.Json
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: log4net.Ext.Json | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///<MyProject>/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: <MyProject>\bin\Debug\log4net-googlecloudlogging-console.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///<MyProject>/bin/Debug/log4net.Ext.Json.DLL.
LOG: Attempting download of new URL file:///<MyProject>/bin/Debug/log4net.Ext.Json/log4net.Ext.Json.DLL.
LOG: Attempting download of new URL file:///<MyProject>/bin/Debug/log4net.Ext.Json.EXE.
LOG: Attempting download of new URL file:///<MyProject>/bin/Debug/log4net.Ext.Json/log4net.Ext.Json.EXE.

log4net:ERROR Failed to create object to set param: layout

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

输出/运行目录中缺少dll log4net.Ext.Json.dll,或者dll log4net.Ext.Json.dll不包含类log4net.Layout.SerializedLayout。首先检查dll,如果没有,则将其复制到目录。

答案 1 :(得分:0)

我想知道您编译的框架是什么?该版本不是.NetStandard准备好了。现在我们发布了包含它的2.0.8版本。尝试更新,如果它仍然无法正常工作,请使用更多上下文更新您的Q.