15.6. Create a Windows Service


You need to create an application that will run as a Windows service.


Create a class that extends System.ServiceProcess.ServiceBase. Use the inherited properties to control the behavior of your service, and override inherited methods to implement the functionality required. Implement a Main method that creates an instance of your service class and passes it to the Shared ServiceBase.Run method.


The ServiceBase class is defined in the System.ServiceProcess assembly, so you must include a reference to this assembly when you build your service class.

How It Works

To create a Windows service manually, you must implement a class derived from the ServiceBase class. The ServiceBase class provides ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.