End Google Ads 201810 - BS.net 01 --> I created a Windows Service that is installed on a server. Whenever any type of any error is thrown, the error is logged and the service stops.

Is there anyway to setup my try/catch to make sure the service continues to run after the error is logged?

static void Main(string[] args)
{
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomain_UnhandledException);

#if !DEBUG
try {
#endif // If Debug Mode, run Application
// Otherwise, setup as service
#if DEBUG
isDebugMode = true;
object debug = new object();
MessagingBroker(debug);
#else ServiceBase.Run(new Program());
#endif #if !DEBUG
}
catch (Exception e)
{
// Log Error to Event Viewer
string msg = "Error: " + e.Source + "\r\n";
msg += "Message: " + e.Message + "\r\n";
msg += "Stack Trace: " + e.StackTrace;
sEvent = e.Source;
LogEvent(msg, EventLogEntryType.Error);
}
#endif}
Thanks,
Joe Brislin