Windows Services

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Windows Services as PDF for free.

More details

  • Words: 738
  • Pages: 9
Windows Services  It

is used to define the background process for any windows based applications.

 Note

 in previous technology applications windows service is used to called as NT services.

Steps to design Windows Services 



Step 1 Select Windows Service Template from the VS.Net IDE. Specify the name for the windows service [ for e.g  simplewindowsservice1 ] note  the name of the windows service application will be used for registering the windows service to the service registry. Step 2  right click any where in the form and click on add installer. Note  The above step will define  ServiceProcessInstaller and  ServiceInstaller

Steps to design Windows Services 

ServiceProcessInstaller This is used to specify the Account type for the windows service. Account types supported by the windows service are Local Service  if account type is set to the local service then that service can be used by all the users registered with in the system. Network Service  if account type is set to the network service then that service can be used by all the users connected within the network. Note  if the account type is either Local Service or Network Service then that windows service cant interact with the desktop. User(default)  if the account type of the windows service is user then that service can be used only by that application.

Steps to design Windows Services

 



Local System  it is same as the local service but it has a capability to interact with the user desktop. ServiceInstaller  It is used to specify the display name of the windows service to be displayed at the service registry service name of the windows service and also the start up type for the service. Note  service name specified at the ServiceInstaller will be used to bind the windows service to the dot net applications. Step 3 set the properties for the ServiceProcessInstaller and the ServiceInstaller for serviceProcessInstaller : account  localsystem for serviceInstaller  display name  simple windows (any name)service service name  simple (any name) service start type  manual

Steps to design Windows Services   

Step 4  click on the service1.vb[design] tab. Step 5  click on the “click here to switch to code view” link button. Step 6  write the code as per the requirement on the relevant procedures. For e.g onStartEvent msgbox(“service started”) onStopEvent msgbox(“service stopped”) when ever any value is been passed from the application to the windows service then it can be collected from the onstart method using its parameter “args”







Step 7 click on build  build solution note  the above step will define a windows service application but it will not be registered on to the NT service registry. Step 8 [ in dot net command prompt ] register the windows service to the NT service registry syntax  installutil –i <ApplicationName.exe> note  once a windows service is been registered in order to re-register the service it is mandatory to uninstall the service from the registry to do installutil –u <ApplicationName.exe> To view the windows serives registered on to the NT service registry  start  run  services.msc



To start the service manually to do  right click on the windows service display name on to the registry and click on services  click on the logon tab and then check “allow service to interact with desktop” checkbox  click on apply and then OK buttons.  right click on the display name and click on start to start the service and stop to halt the processing of the service.

Binding windows service to the windows application   





Step 1  select windows application template from VS.Net IDE. Step 2  Design the form as per the requirement. Step 3  Click on the components tab present in the ToolBox and drag drop the service controller control on to the form. Step 4  set the service Name property of the service Controller with the windows service which has to be binded to the application. For e.g service name  simplewindowsservice1 Write the code as per the requirement.

To start the service :serviceControllerName.start([argValue(s)]) note whenever the application has to pass some values to a windows service then argValue(s) should be used.  To stop the service :serviceControllerName.stop() 

Related Documents