Greg Low
1/21/2003 1:18:00 AM
You need to create an "installer". While you have the "design" view of the
service open in VS.NET, you should see an option to create an installer
under the properties window.
HTH
Greg Low
Brisbane, Oztralia
"Lloyd Dupont" <lloyd@galador.net> wrote in message
news:ektDizNwCHA.2668@TK2MSFTNGP09...
> Hi,
>
> I'm trying to create and install a basic service (my firt service !
.cs...)
> Well it compile and install successfully but it doesn't appear in the
> service windows.. so I'm unable to start / stop it!
> do you have any idea ?
>
> I use the following command to compile & install:
> > csc /nologo /out:myservice.exe MyService.cs
> > InstallUtil myservice.exe
>
> and the code is:
> // ---------- MyService.cs ----------------
> using System;
> using System.Diagnostics;
> using System.IO;
> using System.ServiceProcess;
> using System.Threading;
>
> // csc /nologo /out:myservice.exe MyService.cs
> // InstallUtil myservice.exe
> public class MyService : ServiceBase
> {
> public static void Main()
> {
> Run(new MyService());
> }
> StreamWriter outw;
> Thread looping;
> public MyService()
> {
> ServiceName = "MyService";
> CanStop = true;
> CanPauseAndContinue = false;
> AutoLog = true;
> try { outw = new StreamWriter(new FileStream("toto.log",
> FileMode.Create)); }
> catch {}
> }
> protected override void OnStart(string[] args)
> {
> looping = new Thread(new ThreadStart(loop));
> looping.Start();
> }
> public void loop()
> {
> while(true) {
> try { outw.WriteLine(DateTime.Now); }
> catch {}
> Thread.Sleep(1000);
> }
> }
> protected override void OnStop()
> {
> looping.Abort();
> looping = null;
> }
> }
>
>
>
>