【问题标题】:InstallUtil throws TypeLoadException of AssemblySignatureKeyAttributeInstallUtil 抛出 AssemblySignatureKeyAttribute 的 TypeLoadException
【发布时间】:2013-06-20 22:12:01
【问题描述】:

在开发电脑上使用InstallUtil没有报错,服务安装成功。
我打算将它安装在另一台计算机上(它安装了.Net 4.0),所以我将以下文件复制到目标目录:

  • InstallUtil.exe
  • InstallUtil.exe.config
  • InstallUtilLib.dll

在管理员模式下运行 util 后,出现以下异常:

未处理的异常:System.TypeLoadException:无法加载类型 来自程序集的“System.Reflection.AssemblySignatureKeyAttribute” 'mscorlib,版本=4.0.0.0,文化=中性, PublicKeyToken=b77a5c561934e089'。在 System.ModuleHandle.ResolveType(RuntimeModule 模块, Int32 typeToken, Int Ptr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInst Count, ObjectHandleOnStack 类型)在 System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule 模块, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] 遇到 hodInstantiationContext) 在 System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, 类型 [] 通用类型参数,类型 [] 通用方法参数)在 System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttrib uteRecord caRecord、MetadataImport 范围、Assembly& lastAptcaOkAssembly,运行时模块 decoratedModule,MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable、Object[] 属性、IList derivedAttributes、 RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters , Boolean& isVarArg) 在 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule 装饰模块,Int32 装饰元数据令牌,Int32 pcaCount, RuntimeType 属性FilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecorate dTargetSecurityTransparent)
在 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly 组装,RuntimeType caType) 在 System.Reflection.RuntimeAssembly.GetCustomAttributes(类型 属性类型,布尔继承)在 System.Configuration.InstallUtil.Main(String[] args)

似乎连InstallUtil都无法启动,所以无法安装服务。
我应该检查什么?

【问题讨论】:

    标签: .net windows-services installutil


    【解决方案1】:

    您可以尝试从 C:\Windows\Microsoft.NET\Framework\v4.0.30319\ 或其他相关文件夹(在 C:\Windows\Microsoft.NET 内)运行“installutil.exe”吗??

    我主要认为,您看到的错误主要是因为 .NET 版本不匹配。

    【讨论】:

    • 你是对的,我使用的是不同的版本,并没有使用已经安装的版本。很棒的收获。作为旁注:如果这样,我设法使用 sc.exe。
    • 嘿.. 谢谢.. sc.exe 会工作。但是,如果您想以正确的方式进行操作,这不是最好的命令。请参阅下面的问题以获得 Hans 的充分理由。 stackoverflow.com/questions/4692250/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    相关资源
    最近更新 更多