服务 在初始化安装时发生异常:System.IO.FileNotFoundException: "file:///D:\testService"未能加载文件或程序集。系统找不到指定文件。

2022-10-20,,,,

@echo.
@if exist "%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe" goto INSTALL4.0

:INSTALL4.0
@echo ◎ 开始安装服务2.0
@%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe   xx.Service
@echo.
@echo √ 服务安装完成!
@goto Ed
 
:ERR
@echo.
@echo × 程序运行期间出错,安装过程失败,请重新安装本软件!
@echo off

:Ed
@echo.
@echo 按任意键退出......
@pause>nul
@exit

//***********************************************************************************************

如上,
初始化安装时发生异常:
System.IO.FileNotFoundException:
"file:///D:\testService"未能加载文件或程序集。系统找不到指定文件。

原因是:

InstallUtil  WindowsService1.exe

把  “.exe" 加上

正确的命令行:

@echo.
@if exist "%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe" goto INSTALL4.0

:INSTALL4.0
@echo ◎ 开始安装服务2.0
@%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe   xx.Service.exe
@echo.
@echo √ 服务安装完成!
@goto Ed
 
:ERR
@echo.
@echo × 程序运行期间出错,安装过程失败,请重新安装本软件!
@echo off

:Ed
@echo.
@echo 按任意键退出......
@pause>nul
@exit

服务 在初始化安装时发生异常:System.IO.FileNotFoundException: "file:///D:\testService"未能加载文件或程序集。系统找不到指定文件。的相关教程结束。

《服务 在初始化安装时发生异常:System.IO.FileNotFoundException: "file:///D:\testService"未能加载文件或程序集。系统找不到指定文件。.doc》

下载本文的Word格式文档,以方便收藏与打印。