-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Suresh Kumar R
Message 1 in Discussion

Hi folks,   I have seen in the quickstart sample for "Services" the following code, 
SimpleService.cs & ProjectInstaller.cs   SimpleService.cs  ^^^^^^^^^^^^^ using System; 
using System.ServiceProcess; using System.Diagnostics; using System.Timers;  public 
class SimpleService: ServiceBase {     protected Timer timer;      public static void 
Main() {         ServiceBase.Run(new SimpleService());     }      public 
SimpleService()     {         CanPauseAndContinue = true;         ServiceName = 
"Hello-World Service";          timer = new Timer();         timer.Interval = 1000;    
     timer.Elapsed += new ElapsedEventHandler(OnTimer);     }      protected override 
void OnStart(string[] args)     {         EventLog.WriteEntry("Hello-World Service 
started");         timer.Enabled = true;     }      protected override void OnStop()   
  {         EventLog.WriteEntry("Hello-World Service stopped");         timer.Enabled 
= false;     }      protected override void OnPause()     {         
EventLog.WriteEntry("Hello-World Service paused");         timer.Enabled = false;     
}      protected override void OnContinue()     {         
EventLog.WriteEntry("Hello-World Service continued");         timer.Enabled = true;    
 }      protected void OnTimer(Object source, ElapsedEventArgs e)     {         
EventLog.WriteEntry("Hello World!");     } } 
 ProjectInstaller.cs ^^^^^^^^^^^^^^using System; using System.Collections; using 
System.Configuration.Install; using System.ServiceProcess; using 
System.ComponentModel;  [RunInstallerAttribute(true)] public class ProjectInstaller: 
Installer{      private ServiceInstaller serviceInstaller;     private 
ServiceProcessInstaller processInstaller;      public ProjectInstaller(){          
processInstaller = new ServiceProcessInstaller();         serviceInstaller = new 
ServiceInstaller();          // Service will run under system account         
processInstaller.Account = ServiceAccount.LocalSystem;          // Service will have 
Start Type of Manual         serviceInstaller.StartType = ServiceStartMode.Manual;     
     serviceInstaller.ServiceName = "Hello-World Service";          
Installers.Add(serviceInstaller);         Installers.Add(processInstaller);     } }   
Now the question is, as mentioned in the tutorial, I have compiled the SampleService 
as an exe and used the  
"InstallUtil.exe SimpleService.exe" 
Now I have a question.. 
What is the use of "ProjectInstaller.cs" this. What it will do, I am not seeing any 
info in the Quickstart regarding this. 
How can I see the SimpleService in the Service Control Manager..? 
Thanks 
Suki
 
  

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to