Registering a Windows Service is always a challenge .
I personally prefer to write / use a script. Below is a script which will install a Windows Service and start it once its installed properly. By default it will set the Mode "Automatic When windows OS starts".
Step 1: Create a batch file (eg., Register.bat) and put it in the same foler where your windows service executable file resides).
Step 2: Copy the below script and paste it in above "Register.bat" file.
@ECHO OFF
REM The following directory is for .NET 2.0
set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727
set PATH=%PATH%;%DOTNETFX2%
echo Installing WindowsService...
echo ---------------------------------------------------
InstallUtil /i WINDOWS_SERVICE_NAME
net start WINDOWS_SERVICE.EXE
echo ---------------------------------------------------
pause
echo Done.
Step 3: Replace your windows Service executable file with "WINDOWS_SERVICE_NAME" and "WINDOWS_SERVICE.EXE" string.
Step 4: Save -> Exit from the file.
Now the batch file is reay to install the windows service. Just double click the "Register.bat" file.
Isn't it very easy !!!!
Saturday, 30 May 2009
How to Register .NET Windows Service ?
Posted on 00:57 by Unknown
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment