Install windows service using command promt

18,766

Solution 1

File paths with spaces in them must be quoted.

Good

installutil "c:\my directory\service1.exe"

Bad

installutil c:\my directory\service1.exe

The OS stops reading the path at the first space, causing it to look for a file named"c:\my", which does not exist.

Solution 2

i have the same problem, in this case Service.exe was blocked.

Solution : right-click on the file and open Properties. You may see a message – This file came from another computer and might be blocked to help protect this computer. Click on the Unblock button and then on Apply/OK

Solution 3

Missing quotes was the problem. Installutil "path of exe/d"

Share:
18,766
user1208862
Author by

user1208862

Updated on June 26, 2022

Comments

  • user1208862
    user1208862 almost 2 years

    I am installing a windows service using visual studio command prompt using the following command

    installutil D:\Folder1\Projectname\bin\Debug\Service1.exe
    

    But I get the following exception

    Exception occurred while initializing the installation:System.IO.FileNotFoundException: Could not load file or assembly 'file:///D:\Folder1\WIN' or one of its dependencies. The system cannot find the file specified..

    Is the command wrong or Am I missing anything else?