How to run an application as a windows service

You may want sometime to run your windows app or a console application even you log off the machine. In order to work even the windows is log off, you need to run your application as a windows service.

So, how to run an application as a windows service ? Here is the solution.

1) Please install windows resource kit (both xp or windows 2003) from here
2) Start windows command prompt
3) Execute > cd "your windows resource kit path" ex: CD "C:\Program Files\Windows Resource Kits\Tools"
4) Execute > Instsrv.exe YourServiceName "C:\Program Files\Windows Resource Kits\Tools\Srvany.exe"
5) Open regedit > go to> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\YourServiceName
6) add following KEY : Parameters
7) Add value to the above key :  Value = Application, Type : REG_SZ, Value : "path to your exe"
8) Close the reg edit
9) Go to Control Panel > Service > Edit your Service properties > Change settings as you wish
10 ) run your service

You are done............!

Comments

Popular posts from this blog

Embedding PowerBI with ASP.NET Core 2 and Angular(2,4,5)

Handling Exit Event of Console Application in C#

Taxi - Cab services in Colombo - Sri Lanka