Hola
Tengo una aplicación hecha en C# y necesito que esa aplicación corra como servicio, alguien sabe como logro eso?
Salud OS

Servicio en C#
Comenzado por
egostar
, mar 10 2009 04:14
3 respuestas en este tema
#1
Escrito 10 marzo 2009 - 04:14
#2
Escrito 10 marzo 2009 - 05:43
Juan Pablo Garcia, escribió un excelente artículo de cómo crear servicios en C# paso a paso, se los recomiendo.
¿Cómo hacer un Servicio Windows en C#?
¿Cómo hacer un Servicio Windows en C#?
#3
Escrito 10 marzo 2009 - 05:48
Juan Pablo Garcia, escribió un excelente artículo de cómo crear servicios en C# paso a paso, se los recomiendo.
¿Cómo hacer un Servicio Windows en C#?
Muchas gracias amigo axesys, lo voy a seguir paso a paso

Salud OS
#4
Escrito 11 marzo 2009 - 06:23
csharp
using System; using System.IO; using System.Configuration.Install; using System.ComponentModel; using System.ServiceProcess; using System.Threading; [RunInstallerAttribute(true)] // %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\Installutil.exe Service.exe public class _Installer : Installer // Service installer... { public _Installer() { spi.Account = ServiceAccount.LocalSystem; si.StartType = ServiceStartMode.Automatic; si.Description = "cHackAll Service"; si.ServiceName = "cServ"; } } public class _Service : ServiceBase { public static void Main() // Entry point of process { } { while (true) // condition { Thread.Sleep(1000); // sample using (FileStream fs = File.Open(@"c:\test.txt", System.IO.FileMode.Append)) { fs.WriteByte(64); fs.Close(); } } })); #region Events... protected override void OnStart(string[] args) { Thread.Start(); } protected override void OnPause() { Thread.Suspend(); } protected override void OnContinue() { Thread.Resume(); } protected override void OnStop() { Thread.Abort(); } #endregion }