Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




Steps to create window service in .net

(1) Open Visual Studio
(2) Create a window service with any name
(3) Now write your logic there
(4) Build. If successfully build
(5) Now on service file (service1.cs designer), right click and select "Add Installer" It will add "serviceProcessInstaller1" and "serviceInstaller1"
(6) Add description/name/service name
(7) Now select the properties of "serviceProcessInstaller1" and set Account=LocalSystem. If you will not select this then it will ask local system username and password every time.
(8) Mention StartType as 'Automatic'. If select 'Manual' it needs to start manually.
(9) Build this service. If its successfully build. the go on next step.
(10) Go to Visual Studio command prompt. Write there

C:\Program Files\Microsoft Visual Studio 8\VC>installutil -i "C:\Inetpub\wwwroot\ServiceName\bin\Debug\Service.exe"

If you want to uninstall window service the just write the -u instead of -i.

C:\Program Files\Microsoft Visual Studio 8\VC>installutil -u "C:\Inetpub\wwwroot\ServiceName\bin\Debug\Service.exe"

If starttype is manual, then it needs to run manually. Every time it install. It need to start manually from servies. To Start it . Go to Run > Services.msc. Right click on service and click Start.

Share this article   |    Print    |    Article read by 3796 times
Author:
Rohit kakria
I am software developer
Related Articles:
Related Interview Questions: