您的位置:首页 > 其它

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

2015-05-13 13:01 2879 查看
@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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐