質問

私はバッチファイルを使用してWindowsサービスをインストールしようとしている、のは、「あるinstallService.bat」と呼んでみましょう。ファイルの中に私は、次のコマンドを持っています:

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

私はこれを取得する(Vistaで管理者として実行している)バッチファイルをexcuteときます:

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餌を与えない?

他のヒント

あなたが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