home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / QuickStart / howto / doc / simpleservice.aspx < prev    next >
Encoding:
Text File  |  2000-06-08  |  2.8 KB  |  58 lines

  1.  
  2. <!-- #include virtual="/quickstart/howto/include/header.inc" -->
  3.  
  4. <h4>How Do I...Write a simple service application?</h4>
  5.  
  6. <div class="indent" style="width:660"><font face="Tahoma" size="1">
  7.  
  8. <p>Microsoft Windows NT services enable you to create long-running executable applications 
  9. that run in their own Windows sessions. These services can be automatically started when 
  10. the computer boots, can be paused and restarted, and typically do not show any user 
  11. interface. This makes services ideal for use on a server or whenever you need long-running 
  12. functionality that does not interfere with other users who are working on the same computer. 
  13. You can also run services in the security context of a specific user account that is 
  14. different from the logged-on user or the default computer account. For more information 
  15. about services and Windows sessions, see the "About Services" section in the 
  16. Platform SDK documentation in MSDN Online.</p>
  17.  
  18. <p>Using the NGWS framework, you can easily create services by creating an application that 
  19. is installed as a service. For example, suppose you want to monitor performance counter data 
  20. and react to threshold values. You could do this by writing an NT service and deploying it 
  21. to the computer that has the counters you want to monitor.</p>
  22.  
  23. <p>This sample is such a simple service application. You can install it using the NGWS SDK 
  24. Installation Utility. From a command prompt run:</p>
  25.  
  26.     </font><font face="Courier New" color="Blue" size="1"><blockquote>
  27.         > InstallUtil.exe SimpleService.exe
  28.     </blockquote></font><font face="Tahoma" size="1">
  29.  
  30. <p>After the installation is completed you can start the Hello-World Service from the 
  31. Services Management Console. After the service starts you should see the service's event 
  32. log being filled with greetings from the sample service. You can use the Services 
  33. Management Console to pause, continue, start, and stop the service, and observe how such 
  34. operations affect the messages written to the event log. After you are done experimenting 
  35. with the sample, you may uninstall the service by running the following command from the 
  36. command window (you should stop the service before uninstalling it):</p>
  37.  
  38.     </font><font face="Courier New" color="Blue" size="1"><blockquote>
  39.         > InstallUtil.exe /u SimpleService.exe
  40.     </blockquote></font><font face="Tahoma" size="1">
  41.  
  42. </font></div>
  43.  
  44. <h4>Example</h4>
  45.  
  46. <div class="indent">
  47.  [<a target="_blank" href="/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/Services/ServiceApplication/SimpleService/SimpleService.src">View Source</a>]
  48. </div>
  49.  
  50. <h4>Source Code</h4>
  51.  
  52. <div class="code">
  53. <xmp>
  54. <!-- #include virtual="/quickstart/howto/samples/Services/ServiceApplication/SimpleService/SimpleService.cs" -->
  55. </xmp>
  56. </div>
  57.  
  58. <!-- #include virtual="/quickstart/howto/include/footer.inc" -->