Enclosing service execution in try-catch
Posted
by Sorin Comanescu
on Stack Overflow
See other posts from Stack Overflow
or by Sorin Comanescu
Published on 2010-05-10T08:28:03Z
Indexed on
2010/05/10
8:34 UTC
Read the original article
Hit count: 253
Hi,
Below is the usual Program.cs content for a windows service program:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new MyService()
};
ServiceBase.Run(ServicesToRun);
}
}
Is it a bad practice to enclose the ServiceBase.Run(...)
in a try-catch block?
Thanks.
© Stack Overflow or respective owner