C# 未处理System.InvalidOperationException HResult=-2146233079

1.异常信息:

未处理System.InvalidOperationException

HResult=-2146233079

Message=The custom trace listener 'custom listener' does not have a listener type name set or the type is invalid (F:\CBCT64\Output\Polaris.exe.Config line 45).

Source=Microsoft.Practices.EnterpriseLibrary.Logging

StackTrace:

在 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.BasicCustomTraceListenerData.GetConstructor(Type[] constructorParameters)

在 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.BasicCustomTraceListenerData.CoreBuildTraceListener(LoggingSettings settings)

在 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.CustomTraceListenerData.CoreBuildTraceListener(LoggingSettings settings)

在 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.TraceListenerData.BuildTraceListener(LoggingSettings settings)

在 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings.BuildTraceListener(String name, ConfigurationElement requestor)

在 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings.<>c__DisplayClass45_0.<BuildTraceSource>b__0(TraceListenerReferenceData tln)

在 System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()

在 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)

在 Microsoft.Practices.EnterpriseLibrary.Logging.LogSource..ctor(String name, IEnumerable`1 traceListeners, SourceLevels level, Boolean autoFlush)

在 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings.BuildTraceSource(TraceSourceData tsd, Dictionary`2 listeners)

在 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings.<>c__DisplayClass44_0.<BuildLogWriter>b__1(TraceSourceData tsd)

在 System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)

在 System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)

在 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings.BuildLogWriter()

在 Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterFactory.LogWriterConfigurationBuilder.Create()

在 Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterFactory.Create()

在 Foundation.Logger.Logger.SetLogWriter()

在 Polaris.EntryPoint.Main(String[] args)

InnerException:

FileName=LogViewerByMonth, Culture=neutral

FusionLog==== 预绑定状态信息 ===

日志: DisplayName = LogViewerByMonth, Culture=neutral

(Partial)

警告: 为程序集提供了部分绑定信息:

警告: 程序集名称: LogViewerByMonth, Culture=neutral | 域 ID: 1

警告: 当仅提供程序集显示名称的一部分时,将发生部分绑定。

警告: 这可能导致联编程序加载错误的程序集。

警告: 建议为程序集提供完全指定的文字标识,

警告: 并由简单名称、版本、区域性和公钥标记组成。

警告: 有关此问题的详细信息和常见解决方案,请参见白皮书 http://go.microsoft.com/fwlink/?LinkId=109270。

日志: Appbase = file:///F:/CBCT64/Output/

日志: 初始 PrivatePath = NULL

调用程序集: Microsoft.Practices.EnterpriseLibrary.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null。

===

日志: 此绑定从 default 加载上下文开始。

日志: 正在使用应用程序配置文件: F:\CBCT64\Output\Polaris.exe.Config

日志: 使用主机配置文件:

日志: 使用 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config 的计算机配置文件。

日志: 此时没有为引用应用策略(私有、自定义、分部或基于位置的程序集绑定)。

日志: 尝试下载新的 URL file:///F:/CBCT64/Output/LogViewerByMonth.DLL。

日志: 尝试下载新的 URL file:///F:/CBCT64/Output/LogViewerByMonth/LogViewerByMonth.DLL。

日志: 尝试下载新的 URL file:///F:/CBCT64/Output/LogViewerByMonth.EXE。

错误: 未能完成程序集的安装(hr = 0x8007000b)。探测终止。

HResult=-2147024885

Message=未能加载文件或程序集"LogViewerByMonth, Culture=neutral"或它的某一个依赖项。试图加载格式不正确的程序。

Source=mscorlib

StackTrace:

在 System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)

在 System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)

在 System.Type.GetType(String typeName, Boolean throwOnError)

在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.AssemblyQualifiedTypeNameConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)

在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.NameTypeConfigurationElement.get_Type()

在 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.BasicCustomTraceListenerData.GetConstructor(Type[] constructorParameters)

InnerException:

2.解决方法

(1)检查 Polaris.exe.Config 文件,确保custom listener节点配置正确。确认自定义跟踪侦听器的名称是否正确,以及是否设置了正确的侦听器类型名称。

复制代码
<add name="custom listener" />

(2)在问题描述中可以看到红色字体部分,重新生成"LogViewerByMonth"项目。

其他注意点

  1. 确认自定义跟踪侦听器的类是否存在,并且它实现了正确的接口。确保类的名称与配置文件中指定的侦听器类型名称匹配。
  2. 检查自定义跟踪侦听器的代码,确保它正确地实现了必要的接口和方法。确保类的构造函数没有任何错误或异常。
  3. 如果可能的话,尝试重新编译和部署应用程序,以确保所有的依赖项都正确加载。
  4. 如果问题仍然存在,可能需要查看更详细的错误信息或日志,以获取更多的上下文和线索。查看应用程序的日志文件或使用调试工具来获取更详细的错误信息。

3.其他问题

未处理System.TypeInitializationException

HResult=-2146233036

Message="ExaminationUI.IPWInitliazer"的类型初始值设定项引发异常。

Source=ExaminationUI

TypeName=ExaminationUI.IPWInitliazer

StackTrace:

在 ExaminationUI.IPWInitliazer.Initlizer()

在 ExaminationUI.Examation..ctor()

在 Polaris.EntryPoint.Main(String[] args)

InnerException:

FileName=XRayIPWraper, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

FusionLog==== 预绑定状态信息 ===

日志: DisplayName = XRayIPWraper, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

(Fully-specified)

日志: Appbase = file:///F:/CBCT64/Output/

日志: 初始 PrivatePath = NULL

调用程序集: ExaminationUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null。

===

日志: 此绑定从 default 加载上下文开始。

日志: 正在使用应用程序配置文件: F:\CBCT64\Output\Polaris.exe.Config

日志: 使用主机配置文件:

日志: 使用 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config 的计算机配置文件。

日志: 此时没有为引用应用策略(私有、自定义、分部或基于位置的程序集绑定)。

日志: 尝试下载新的 URL file:///F:/CBCT64/Output/XRayIPWraper.DLL。

错误: 未能完成程序集的安装(hr = 0x8007000b)。探测终止。

解决方案同上。

相关推荐
mudtools2 小时前
.NET驾驭Word之力:玩转文本与格式
c#·.net
唐青枫6 小时前
C#.NET 数据库开发提速秘籍:SqlSugar 实战详解
c#·.net
mudtools1 天前
.NET驾驭Word之力:理解Word对象模型核心 (Application, Document, Range)
c#·.net
大飞pkz1 天前
【设计模式】C#反射实现抽象工厂模式
设计模式·c#·抽象工厂模式·c#反射·c#反射实现抽象工厂模式
唐青枫1 天前
从入门到进阶:C#.NET Stopwatch 计时与性能测量全攻略
c#·.net
未来之窗软件服务2 天前
幽冥大陆(二)RDIFSDK 接口文档:布草洗涤厂高效运营的技术桥梁C#—东方仙盟
开发语言·c#·rdif·仙盟创梦ide·东方仙盟
1uther2 天前
Unity核心概念⑨:Screen
开发语言·游戏·unity·c#·游戏引擎
阿幸软件杂货间2 天前
Office转PDF转换器v1.0.py
开发语言·pdf·c#
sali-tec2 天前
C# 基于halcon的视觉工作流-章34-环状测量
开发语言·图像处理·算法·计算机视觉·c#
玉面小君2 天前
从 WPF 到 Avalonia 的迁移系列实战篇6:Trigger、MultiTrigger、DataTrigger 的迁移
wpf·avalonia