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