Enclosing service execution in try-catch
- by Sorin Comanescu
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.