- Windows Services are processes that run in their own user-session without any UI.
- Windows Services inherit from ServicesBase class.
- The Main( ) method in a service contains code to call Run( ) method responsible for starting/executing the service.
- The OnStart( ) method method should NOT stick into an infinte loop not should it get blocked. If we wish to create polling mechanism, use System.Timers.Timer object.
- To override OnPause( ), OnContinue( ) and OnShutDown( ) methods, first set ServiceBase.CanPauseAndContinue or ServiceBase.CanShutdown to true.
- Remember to always set the ServiceName property in the property pane.
- System.ServiceProcess.ServiceController class is required to interact with a service from .NET Assembly.
- To install the service, we need ServiceInstaller and ServiceProcessInstaller objects (automatically created in Visual Studio when we right click Service Design View and choose Add Installer)
- LocalService is the least previliged Account and LocalSystem is the most previliged Account property for ServiceProcessInstaller.
- While creating MSI installer for Service, add Project Output from Service Project as Primary Output and then add a Custom Action. (refer to page 462-463)
- To record Exceptions for a Service use EventLog.
Saturday, July 18, 2009
Chapter 8-Lesson 3
Labels:
Custom Action,
Project Output,
ServiceInstaller,
Services,
Timer,
Windows Services
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment