문제

배치 파일을 사용하여 Windows 서비스를 설치하려고합니다. "installService.bat"이라고 부릅니다. 파일 안에는 다음과 같은 명령이 있습니다.

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe -i ".\MyService.exe"
    pause

배치 파일 (Vista에서 관리자로 실행)을 강화하면 다음과 같습니다.

Exception occurred while initializing the installation:
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Win
dows\system32\MyService.exe' or one of its dependencies. The system cannot f
ind the file specified..

실제 서비스는 c : services myservice.exe에 있습니다. ". myservice.exe"부분이 올바르게 작동하기위한 부분은 무엇입니까?

도움이 되었습니까?

해결책

전체 경로를 설치하는 이유는 무엇입니까?

다른 팁

다른 사람 이이 오류를 위해 여기에 오는 경우를 대비하여 ... installutil.exe를 실행할 때 서비스 경로에 공백이 포함 된 경우 인용문으로 둘러싸여 있습니다. 예, 이것은 분명하지만 그렇지 않은 경우 오류가 발생합니다.

잘못된...

C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe C:\Users\joeblow\Documents\Visual Studio 2010\Projects\WindowsService1\WindowsService1\bin\Debug\WindowsService1.exe

오른쪽...

C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "C:\Users\joeblow\Documents\Visual Studio 2010\Projects\WindowsService1\WindowsService1\bin\Debug\WindowsService1.exe"

BAT 파일 MyService.exe 폴더를 복사하고 실행하면 오류가 발생하지 않습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top