Skip to content

Instantly share code, notes, and snippets.

@rarous
Created May 3, 2013 11:33
Show Gist options
  • Save rarous/5508604 to your computer and use it in GitHub Desktop.
Save rarous/5508604 to your computer and use it in GitHub Desktop.
static void Main()
{
var service = new MyService
{
ServiceName = ConfigurationManager.AppSettings["Service.Name"]
};
#if DEBUG
service.OnStart(null);
Console.WriteLine("Press Ctrl+C to exit.");
var sync = new System.Threading.ManualResetEventSlim(false);
Console.CancelKeyPress += (_, __) => sync.Set();
sync.Wait();
#else
ServiceBase.Run(new[] { service });
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment