2009-08-14 36 views
11

Tôi đang cố gắng cài đặt một Dịch vụ Windows bằng cách sử dụng một tập tin thực thi, hãy gọi nó là "Installservice.bat". Bên trong tập tin tôi có các lệnh sau:Chính xác InstallUtil đường dẫn đến tệp cú pháp?

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

Khi tôi thực thi các tập tin thực thi (chạy as administrator trên Vista) Tôi có được điều này:

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ác dịch vụ thực tế được đặt tại C: \ Services \ MyService.exe. Phần ". \ MyService.exe" nên làm gì để hoạt động đúng?

Trả lời

3

Tại sao không chỉ nạp InstallUtil đường dẫn đầy đủ?

+0

Cảm ơn rất nhiều, không biết rằng sẽ làm việc. –

+0

nó thực sự làm việc cho tôi. – lstanczyk

0

sao chép tệp dơi MyService.exe và thực thi, bạn sẽ không gặp lỗi nào.

9

Chỉ trong trường hợp người khác đến đây vì lỗi này ... khi bạn chạy InstallUtil.exe, nếu đường dẫn đến dịch vụ của bạn chứa khoảng trắng, hãy bao quanh nó bằng dấu ngoặc kép. Có điều này là hiển nhiên, nhưng lỗi nó cung cấp cho bạn nếu bạn không có.

sai ...

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

đúng ...

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ác vấn đề liên quan