Skip to content

Instantly share code, notes, and snippets.

@mizanRahman
Created June 19, 2013 11:49
Show Gist options
  • Select an option

  • Save mizanRahman/5813685 to your computer and use it in GitHub Desktop.

Select an option

Save mizanRahman/5813685 to your computer and use it in GitHub Desktop.
snippet to run windows service from console
static void Main()
{
senTTRFservice service = new senTTRFservice();
if (Environment.UserInteractive)
{
service.OnStart(new string[]{""});
Console.WriteLine("Service Started. at {0}", DateTime.UtcNow);
Console.Read();
service.OnStop();
}
else
{
ServiceBase.Run(service);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment