首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >log4net.ext.json:找不到类型[log4net.Layout.SerializedLayout,log4net.Ext.Json]时出错

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

Stack Overflow用户
提问于 2015-06-09 23:16:54
回答 2查看 1.3K关注 0票数 2

我已经为log4net.Ext.Json安装了nuget包,并从维基上跟踪first steps instructions

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

代码语言:javascript
复制
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

我该如何解决这个问题呢?

EN

回答 2

Stack Overflow用户

发布于 2015-06-10 18:54:58

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

票数 1
EN

Stack Overflow用户

发布于 2018-05-07 03:10:15

我想知道你是用什么框架编译的?这个版本还没有准备好.NetStandard。现在我们发布了2.0.8版本,其中包含了它。尝试更新,如果它仍然不起作用,用更多的上下文更新你的Q。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30736179

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档