You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

.NET Core 6 Windows Service集成EF Core后安装失败求助

.NET Core 6 Windows Service集成EF Core后安装失败

问题描述

我做了一个用于学习的.NET Core 6 Windows Service示例项目:

  • 未集成EntityFramework Core和EF SQLServer包时,使用InstallUtil直接指向Release目录下的exe文件,服务可正常安装并在控制面板中显示。
  • 添加仅包含一个模型的DBContext及EF相关包后,安装流程中止并报错,已尝试使用32位和64位的InstallUtil,均无法解决。

安装阶段日志

C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.exe assembly's progress.
The file is located at C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.InstallLog.
Installing assembly 'C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.exe'.
Affected parameters are:
   logtoconsole =
   assemblypath = C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.exe
   logfile = C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.InstallLog
An exception occurred while trying to find the installers in the C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.exe assembly.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Aborting installation for C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.exe.

An exception occurred during the Install phase.

System.InvalidOperationException: Unable to get installer types in the C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.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..

The Rollback phase of the installation is beginning.
See the contents of the log file for the C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.exe assembly's progress.
The file is located at C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.InstallLog.
Rolling back assembly 'C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.exe'.
Affected parameters are:
   logtoconsole =
   assemblypath = C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.exe
   logfile = C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.InstallLog
An exception occurred while trying to find the installers in the C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.exe assembly.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Aborting installation for C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.exe.
An exception occurred during the Rollback phase of the System.Configuration.Install.AssemblyInstaller installer.
System.InvalidOperationException: Unable to get installer types in the C:\Users\nithyana\source\repos\SampleWindowsService\SampleWindowsService\bin\Release\SampleWindowsService.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 during the Rollback phase of the installation. This exception will be ignored and the rollback will continue. However, the machine might not fully revert to its initial state after the rollback is complete.

The Rollback phase completed successfully.

The transacted install has completed.
The installation failed, and the rollback has been performed. 

已尝试的解决操作

  • 检查发现Release目录缺少EF相关依赖的dll,尝试根据EF包的依赖项单独添加分析器包,但添加后对应的dll仍未出现在Release目录,安装依然失败。

求助

请问可能是什么原因导致这个问题?

内容的提问来源于stack exchange,提问作者Archana Nithyanantham

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 18:31:02