Windows Service

How to find out if a service present in different machine has been stopped or started
 
Use ServiceController Class present in System.ServiceProcess namespace to determine the status of the service. Have a timer in the application which is monitoring the service. The timer should poll service to determine its status.

 
ServiceController c = new ServiceController("<servicename>", "<machine name>");


Does windows service pick up any changes made to app.config when its running ?

No. The service needs to be  restarted to pick up any new changes made to the config file.

Debug a windows service 

 Below are the three methods


1.Create a new test class. Then call the functions from test class.

2.Add a line    System.Diagnostics.Debugger.Break();  wherever you want to debug.At runtime a new instance will be created and debugging can be carried out in separate windows.


3.Please refer 
 http://aspalliance.com/1316_Working_with_Windows_Service_Using_Visual_Studio_2005.6


How to install a windows service

Go to visual studio command prompt. Navigate to path where the exe that you want to install is present.

To install, type
installutil  projectname.exe

To uninstall, type
installutil /u projectname.exe

 

6 comments:

  1. Hey Nice Post, Keep Updating more question and answers
    All It Technologies

    ReplyDelete
  2. That is really Good information thanks a lto

    ReplyDelete
  3. Thank you for imparting such an informative content. I like the way you publish such an useful post which may help many needful. Home tutor services in Delhi are also provided by TheTuitionTeacher in Lucknow
    Home Tutors in Lucknow | Home Tuition Service

    ReplyDelete