Creating Window Service in ASP.NET 1.1


Step 1 :- Create New Service

Image1.gif

Step 2 :- Rename the Service.cs to given name

Image2.gif

Step 3 :-

Write the relevant code in separate entities. Always ensure to have single entry and exit of the code. For better handling and thread security, put the code in "Lock" blocks.

Image3.gif

Step 4 :-

After developing the entities, call the entry method in Service "OnStart" method.

Image4.gif

Step 5 :-

Include System Timer in the service. Make sure to configure the Time Interval settings in Appconfig file. Set the Time interval in "OnStart" Method. Call the appropriate Entry point in the TimeEvent.

Image5.gif


Step 6 : - After completing the development, build the application

Step 7 :- Add Installer to the service. After adding the Installer, edit the properties of the ProcessInstaller and Service Installer.

Image6.gif

Image7.gif


Image8.gif


Modify the settings as per needed, so that service runs smoothly.

Step 8 :- Deployment Details

  1. Create Install.bat and Uninstall .bat files for installing and installing the service
  2. Include "C:\Windows\Microsoft.NET\Framework\v1.1.4322\InstallUtil.exe /i <Servicename>.exe" in Install.bat file
  3. Include "C:\Windows\Microsoft.NET\Framework\v1.1.4322\InstallUtil.exe /u <Servicename>.exe" in Uninstall.bat file
  4. Once the Install.bat file is executed, "InstallUtil.exe.exe" utility will deploy the service into System Services.

    Image9.gif

Start the service when it is needed. Then onwards the service will get executed for the specified Time Interval.

Up Next
    Ebook Download
    View all
    Learn
    View all