C#
  Home arrow C# arrow Page 2 - Timer Objects in Windows Services with C#....
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

Timer Objects in Windows Services with C#.NET
By: Rogier Doekes
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 185
    2004-10-18

    Table of Contents:
  • Timer Objects in Windows Services with C#.NET
  • Setting up the Project
  • Adding Code
  • Coding the Windows Service Start and Stop Event Handlers
  • Building and Installing the Service

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Timer Objects in Windows Services with C#.NET - Setting up the Project


    (Page 2 of 5 )

     
    1. Create a C# Windows Service project and name it TimerSrv.

    Doekes


    The project will come with a class, Service1.cs. Double-click Service1.cs in the project explorer to reveal the properties. Name the service TimerSrv and in the ServiceName field also fill in TimerSrv.

    Doekes

    2. Next we are going to add an installer to the project. Click on the hyperlink Add Installer. A design screen will be added to the project with 2 controls: serviceProcessInstaller1 and ServiceInstaller1.

    3. Click the serviceProcessInstaller1 control and, in the properties dialog, change the account to LocalSystem.

    Doekes

    4. In the serviceInstaller control, change the start type to Automatic, and give it a nice display name, like Timer Service.

    Doekes


    More C# Articles
    More By Rogier Doekes


       · Thanks! Your article was quite helpful, however i couldn't find the "add installer"...
       · Thanks this is the best and simplest article on the usage of timers
       · You can find the AddInstaller option by right click on the properties window where ...
       · This was the best and simple example which I used it to make my first Service....
       · hi, Thanks for your Article. This one is so good to know about the windows service...
       · Heya! This really helped me, as well! Thing is, I got it all to compile & work,...
       · This really helped me a lot to know what the windows services are.
       · Have the same problem. Does anybody knows what the problem is?
       · Your article is very helpful.Hovever, please note that the exe file has been...
       · 1. Manually create the text file (don't trust the program to do it)2. Right click...
       · Go to Design page and right click on disign page u will see the option add...
       · God bless you for posting this neat example. Thanks a lot !!
       · Could not start Timer Service service on local computer.Error 5: access...
       · Is your property serviceProcessInstaller1>Account set to 'LocalSystem'? If set to...
       · Hello, I get the same problem. I am unable to start the service, it tells me that...
       · Thank You Very Much...I went through so many articles before this, But I was not...
       · There's a good explanation about how to add the installer and get the service...
     

    C# ARTICLES

    - Coding a CRC-Generating Algorithm in C
    - Cyclic Redundancy Check
    - Handling Methods and Functions
    - Destroying Objects in C#
    - Creating Objects in C-Sharp
    - Classes and Objects
    - Programming Languages: Managed versus Native
    - LINQ-to-MySQL with DbLinq in C#
    - Working with Dates and Times in C#
    - Generics, Dictionaries, and More
    - More About Generics
    - Working with C# Collections
    - Generics
    - C# and XML
    - Pointers and Arrays in C#





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek