Windows Service: System.Reflection.ReflectionTypeLoadException was thrown with the following error message: Unable to load one or more of the re

Windows Service: System.Reflection.ReflectionTypeLoadException was thrown with the following error message: Unable to load one or more of the re

问题:

The uninstall is beginning.
See the contents of the log file for the MonitorService.exe assembly's progress.
The file is located at MonitorService.InstallLog.
An exception occurred during the uninstallation of the System.Configuration.Install.AssemblyInstaller installer.
System.InvalidOperationException: Unable to get installer types in the MonitorService.exe assembly.
The inner exception System.Reflection.ReflectionTypeLoadException was thrown with the following error message: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information..
An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete.

 

回答

Maybe you need to use another version of InstallUtil.exe:

  • c:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe
  • c:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe
  • c:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe
  • c:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe

Try to use x64 version from Framework64 subfolder.

 

不过还是推荐sc delete serviceName进行删除

 

How to retrieve the LoaderException property?

try
{
  // load the assembly or type
}
catch (Exception ex)
{
  if (ex is System.Reflection.ReflectionTypeLoadException)
  {
    var typeLoadException = ex as ReflectionTypeLoadException;
    var loaderExceptions  = typeLoadException.LoaderExceptions;
  }
}

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(728)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2019-07-01 jQuery find
2019-07-01 jQuery file upload里面的_create的调用和_initEventHandlers的调用
2019-07-01 How jQuery UI Works
2019-07-01 How to Create a Basic Plugin 如何写一个基础的jQuery插件
2019-07-01 npm-package-lock.json
2019-07-01 jQuery widget ui里面比较重要的函数
2019-07-01 jQuery file upload cropper的 click .preview事件没有绑定成功
点击右上角即可分享
微信分享提示