我开发了一个Windows Service
,我做了以下事情:
- 添加了
Installer
- 确保 1 中的
ServiceName
属性ServiceInstaller
与我的服务名称匹配 - 设置正确的参数
- 将项目属性中的启动更改为
serviceName.Program
- 以管理员身份启动 VS 命令工具。
然而,即使在这一切之后,服务的安装,使用Installutil
失败,给出以下错误:
安装程序集“C:\Users\\Documents\Visual Studio 2013\Projects\TestLicenseService\TestLicenseService\bin\Debug\TestLicenseService.exe”。受影响的参数是:logtoconsole = logfile = C:\Users\\Documents\Visual Studio 2013\Projects\TestLicenseService\TestLicenseService\bin\Debug\TestLicenseService.InstallLog assemblypath = C:\Users\\Documents\Visual Studio 2013\Projects\TestLicenseService \TestLicenseService\bin\Debug\TestLicenseService.exe 尝试在 C:\Users\\Documents\Visual Studio 2013\Projects\TestLicenseService\TestLicenseService\bin\Debug\TestLicenseService.exe 程序集中查找安装程序时发生异常。System.Reflection.ReflectionTypeLoadException:无法加载一种或多种请求的类型。检索 LoaderExceptions 属性以获取更多信息。
所有相关的依赖项都存在于正确的文件夹中,但它不会安装该服务。可能是什么问题?
使用 VS2013 和 Windows 8.1。
好心提醒。