- Back to Home »
- Windows Applications »
- Install windows services
Posted by :
Sudhir Chekuri
Thursday, 10 March 2016
Go to "Start" - "All Programs" -"Microsoft Visual Studio 2012" - "Visual Studio Tools" then click "Developer Command Prompt for VS2012".
Go to folder location in which exe is present in command prompt and use the below command to install the windows service application (SampleWindowsService).
InstallUtil.exe “SampleWindowsService.exe”
Successful message will be displayed in command prompt after successful installation.
Go to services and see your windows services which will be names as Service1.
Now this service will be running continuously and will write text in LogFile.txt file which is created in the same folder from where your exe is executed. For every 30 seconds task will be executed and will write new text in that LogFile.
Start and stop your service from services. It will log the start and stop enteries in LogFile as shown below.
3/10/2016 1:21:25 PM: Test window service started
3/10/2016 1:21:55 PM: Job is running
3/10/2016 1:22:25 PM: Job is running
3/10/2016 1:22:55 PM: Job is running
3/10/2016 1:23:25 PM: Job is running
3/10/2016 1:23:55 PM: Job is running
3/10/2016 1:24:25 PM: Job is running
3/10/2016 1:24:41 PM: Test window service stopped
Go to folder location in which exe is present in command prompt and use the below command to install the windows service application (SampleWindowsService).
InstallUtil.exe “SampleWindowsService.exe”
Successful message will be displayed in command prompt after successful installation.
Go to services and see your windows services which will be names as Service1.
Now this service will be running continuously and will write text in LogFile.txt file which is created in the same folder from where your exe is executed. For every 30 seconds task will be executed and will write new text in that LogFile.
Start and stop your service from services. It will log the start and stop enteries in LogFile as shown below.
3/10/2016 1:21:25 PM: Test window service started
3/10/2016 1:21:55 PM: Job is running
3/10/2016 1:22:25 PM: Job is running
3/10/2016 1:22:55 PM: Job is running
3/10/2016 1:23:25 PM: Job is running
3/10/2016 1:23:55 PM: Job is running
3/10/2016 1:24:25 PM: Job is running
3/10/2016 1:24:41 PM: Test window service stopped