Window Services in .Net 2008

Creating Window Services in .Net 2008 and installing the window services. This is easy to understand for beginners. The articles includes step by step screen shots for creating and installing Window Services in .Net 2008. Find the detail about Window Services in .Net 2008.

About Window Services in .Net 2008

Window Services:
1. Microsoft Windows services, formerly known as NT services, enable you to create long-running executable applications that run in their own Windows sessions.
2. These services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface. These features make services ideal for use on a server or whenever you need long-running functionality that does not interfere with other users who are working on the same computer.
3. You can also run services in the security context of a specific user account that is different from the logged-on user or the default computer account.You can create your service as a Microsoft Visual Studio project, defining code within it that controls what commands can be sent to the service and what actions should be taken when those commands are received.
4. Commands that can be sent to a service include starting, pausing, resuming, and stopping the service; you can also execute custom commands.

Service Application Versus Other Visual Studio Application:
1.The Compiled executable File that a service application project creates must be installed on the server before they run in meaningful way. You cannot Debug or run a service Application by pressing F5 or F11. You cannot immediately run a service or step into its code. Instead you must install and start you service and then attach a debugger to the service process.
2.The main method for tour service application must issue run command for the services you project contain. The run method load services into Service Control Manager on the appropriate server. If you use window service template this method return for you automatically.
3.Windows service applications run in their own security context and are started before the user logs into the Windows computer on which they are installed. You should plan carefully what user account to run the service within; a service running under the system account has more permissions and privileges than a user account.

Service Lifetime:
1.A service goes through several internal states in its lifetime. First, the service is installed onto the system on which it will run. This process executes the installers for the service project and loads the service into the Services Control Manager for that computer. The Services Control Manager is the central utility provided by Windows to administer services.
2.After the service has been loaded, it must be started. Starting the service allows it to begin functioning. You can start a service from the Services Control Manager, from Server Explorer, or from code by calling the Start method. The Start method passes processing to the application's Onstart method and processes any code you have defined there
3.A running service can exist in this state indefinitely until it is either stopped or paused or until the computer shuts down. A service can exist in one of three basic states: Running, Paused, or Stopped. The service can also report the state of a pending command: Continue Pending, Pause Pending, Start Pending, or Stop Pending.
4.You can pause, stop, or resume a service from the Services Control Manager, from Server Explorer, or by calling methods in code. Each of these actions can call an associated procedure in the service (Onstart, OnPause,OnContinue) in which you can define additional processing to be performed when the service changes state.


  • window Services (43375-28033-services.docx)
  • Comments

    Guest Author: Lonitra13 Jan 2012

    This has made my day. I wish all postings were this good.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: