posted by Will Senn on Mon 5th Jan 2004 19:35 UTC
IconOK, so you want to create a windows service and you're not a .NET guru? This is exactly what got me in trouble with my wife. It started off easy enough, but before the weekend was through, my wife was getting on to me for spending so much time at the computer. She thought that I should be spending quality time with our family, imagine that. I told her that I was doing some 'personal' research, that, "no, it's not work honey" and "I'm trying to learn some new technology", "think of it as reading a book, only on the computer..." Inanities like that, she wasn't having any of it, of course. Regardless, I am glad to report, I figured it out and just in the nick of time, too.

This guide is the result of long hours, a lot of googleing and frustration. Now, using the GUI and some strategically inserted code, I can create a functional .NET Service skeleton in just under 5 minutes. If you are looking for the easy way to create a .NET service, using the GUI, you won't be disappointed - read on.

Download the source

First Things First - Requirements If you are reading this guide and want to try this out in your own development environment, here is what you will need:

Microsoft Visual Studio .NET (2003 is what I use)

Visual C#
.NET Framework


Starting Up the Environment In order to work with this guide, you will need to start two programs:

Microsoft Visual Studio .NET 2003
Visual Studio .NET 2003 Command Prompt

The Studio is found in the folder:

Microsoft Visual Studio .NET 2003
The Command Prompt is found in the folder:
Microsoft Visual Studio .NET 2003\Visual Studio .NET Tools
You will need the command prompt for installing and uninstalling the service later in this guide.


12 Steps to Service Bliss

Overview

1. Create a Project
2. Browse the Autogenerated Code
3. Rename the .cs File
4. Rename the main Class
5. Add the Service Installer/Uninstaller
6. Create a Timer
7. Do Something Useful
8. Build the Service
9. Install the Service
10. Run the Service
11. Stop the Service
12. Uninstall the Service

By the end of this guide you should have a fair understanding of how to create a working .NET service and install/uninstall it in development.

If you have not already started the IDE, do so now.

Table of contents
  1. "Windows .NET Services, Page 1"
  2. "Windows .NET Services, Page 2"
  3. "Windows .NET Services, Page 3"
  4. "Windows .NET Services, Page 4"
  5. "Windows .NET Services, Page 5"
e p (0)    31 Comment(s)