windows services xml web services certification sig tom perkins
TRANSCRIPT
Windows Services
XML Web Services Certification SIG
Tom Perkins
E-LEARNING XML WEB SERVICES
Chapter 2, Lessons 1 - ?
Reference
• Windows Services: New Base Classes in .NET Make Writing a Windows Service Easy
• Ken Getz• http://msdn.microsoft.com/msdnmag
/issues/01/12/NETServ/
Windows Services
• Applications (executables - .exe)• Run without user context
– Don’t have to be logged in to run– no user interface
• Provide system-level support– System event log– Telephony– Task scheduler
Windows Service Development
• Fairly easy in .NET; difficult in VB6 or C++
• Create a Windows Service Project – Takes care of details
• Creates a class that inherits from ServiceProcess.ServiceBase class
Service you create
Can provide code for:
• OnStart method
• OnStop method
• OnPause method
• OnContinue method
• OnShutdown method
Service Control
Manager (SCM)
You interact with the service
through SCM
requests
other services
methods react to requests
Installing the Service
• Service can’t install itself• You must provide an installer class
– Inherits from Configuration.Install.Installer
• VS Project (for each service)– Creates ServiceProcessInstaller object
• Knows how to install service with SCM
– Creates ServiceInstaller object• Writes info re service to registry
Get Up and Running
• Create the service project (class)• Compile .exe• Use InstallUtil to install• Control Panel Services applet
– Start the service
• Debug use the process containing the service, step thru the code