Navigation

Thursday 30 October 2014

Installing Windows Service with Command Prompt and Visual Studio Command Prompt

We can install windows service into Services on windows server with the help of InstallUtil.exe a
command line utility using 

1. Using Visual Studio Command Prompt 
2. Command Prompt

InstallUtil.exe is the command line utility which is installed with .Net frame work and its path is %WINDIR%\Microsoft.NET\Framework[64]\<framework_version>

I. Using Visual Studio Command Prompt 
  1. On the Windows Start menu or Start screen, choose Visual Studio Visual Studio ToolsDeveloper Command Prompt.
    A Visual Studio command prompt appears.
  2. Access the directory where your project's compiled executable file is located.
  3. Run InstallUtil.exe from the command prompt with your project's executable as a parameter:
           installutil <yourproject>.exe




II. Command Prompt
       Most cases we use visual studio command prompt but production server may not have visual studio installed, so we need to use command prompt. For this we have to change the directory path to the directory where InstallUtil.exe is located depends on framework used to create service and the version(32 bit or 64 bit) of .NET frame work

For the 32 bit version of the .Net framework 4.0 or 4.5 its path is C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe.For the 64 bit version of the .Net framework 4.0 or 4.5 its path is C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe



If .NET framework is below 4.0 version or your service is developed using .NET framework 3.5 or below, we have to use InstallUtil.exe which we can find at C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe for 32 bit version framework. Use  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe for 64 bit version 




No comments:

Post a Comment