Windows Service 问题System.IO.FileNotFoundException: 未能加载文件或程序集“file:///”或它 的某一个依赖项。系统找不到指定的文件。。


bat文件 内容为

cd C:\Windows\Microsoft.NET\Framework\v4.0.30319\
InstallUtil.exe  
InstallUtil F:\Windows Services\WindowsServiceTest\WindowsServiceTest_1_0_0_0\WindowsServiceTest.exe
Net Start Service1
pause

其中C:\Windows\Microsoft.NET\Framework\v4.0.30319\为installutil的路径

WindowsServiceTest.exe为Windows Service服务的应用程序,教程

Service1为服务名

ps:.bat与WindowsServiceTest.exe在同一路径

 

【出现问题】

在初始化安装时发生异常:

System.IO.FileNotFoundException: 未能加载文件或程序集“file:///F:\Windows”或它

的某一个依赖项。系统找不到指定的文件。。

 

原因:

路径中出现了空格

 

解决方案:文件放到没有空格的路径

eg:

F:\WindowsServiceTest_1_0_0_0\WindowsServiceTest.exe


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM