文章目录
Windows无法启动MyAlertService服务(位于本机计算机上)。 错误1083:配置成该可执行程序中运行的这个服务不能执行该服务。
问题描述
自定义创建的服务,启动时报错,报错内容为:
“Windows无法启动MyAlertService服务(位于本机计算机上)。 错误1083:配置成该可执行程序中运行的这个服务不能执行该服务。”
查看事件查看器
原因分析
查看属性和代码文件
查看服务启动日志
控制台
日志
解决方案
注释一个即可。我注释掉了手写的配置,保留了属性配置。
卸载服务
语法:installutil.exe /uninstall 你的项目的绝对路径\bin\debug\AlertWindowsService.exe
如:
installutil.exe /uninstall D:\mm\vs2022\AlertWindowsService\AlertWindowsService\bin\debug\AlertWindowsService.exe
取消手写配置
重新生成程序
安装服务
安装程序路径:C:\Windows\Microsoft.NET\Framework64\v4.0.30319
安装服务语法
installutil.exe 你的项目绝对路径\bin\debug\AlertWindowsService.exe
如:
installutil.exe D:\mm\vs2022\AlertWindowsService\AlertWindowsService\bin\debug\AlertWindowsService.exe