Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
QuestionHow to set colour column in datagridview Pin
NarVish14-Apr-10 18:09
NarVish14-Apr-10 18:09 
AnswerRe: How to set colour column in datagridview Pin
ali_reza_zareian14-Apr-10 20:07
ali_reza_zareian14-Apr-10 20:07 
QuestionReturn type error Pin
mprice21414-Apr-10 17:28
mprice21414-Apr-10 17:28 
AnswerRe: Return type error Pin
ali_reza_zareian14-Apr-10 20:14
ali_reza_zareian14-Apr-10 20:14 
GeneralRe: Return type error Pin
mprice21415-Apr-10 3:02
mprice21415-Apr-10 3:02 
QuestionMimic Active Directory browser... Pin
Jacob Dixon14-Apr-10 14:48
Jacob Dixon14-Apr-10 14:48 
QuestionEntity Framework and 'char' type mapping Pin
student_rhr14-Apr-10 10:21
student_rhr14-Apr-10 10:21 
QuestionWindows Service - Service Automatically stops when error is thrown Pin
Joe Brislin14-Apr-10 9:13
Joe Brislin14-Apr-10 9:13 
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

AnswerRe: Windows Service - Service Automatically stops when error is thrown Pin
PIEBALDconsult14-Apr-10 11:06
mvePIEBALDconsult14-Apr-10 11:06 
GeneralRe: Windows Service - Service Automatically stops when error is thrown Pin
Joe Brislin14-Apr-10 11:44
Joe Brislin14-Apr-10 11:44 
AnswerRe: Windows Service - Service Automatically stops when error is thrown Pin
Michel Godfroid14-Apr-10 12:56
Michel Godfroid14-Apr-10 12:56 
GeneralRe: Windows Service - Service Automatically stops when error is thrown Pin
PIEBALDconsult14-Apr-10 13:03
mvePIEBALDconsult14-Apr-10 13:03 
GeneralRe: Windows Service - Service Automatically stops when error is thrown Pin
Michel Godfroid14-Apr-10 13:10
Michel Godfroid14-Apr-10 13:10 
GeneralRe: Windows Service - Service Automatically stops when error is thrown Pin
Joe Brislin15-Apr-10 4:16
Joe Brislin15-Apr-10 4:16 
GeneralRe: Windows Service - Service Automatically stops when error is thrown Pin
PIEBALDconsult15-Apr-10 4:58
mvePIEBALDconsult15-Apr-10 4:58 
QuestionHelp with a Log-in Screen Pin
Geodude48714-Apr-10 7:24
Geodude48714-Apr-10 7:24 
AnswerRe: Help with a Log-in Screen Pin
William Winner14-Apr-10 8:19
William Winner14-Apr-10 8:19 
AnswerRe: Help with a Log-in Screen Pin
OriginalGriff14-Apr-10 8:20
mveOriginalGriff14-Apr-10 8:20 
GeneralRe: Help with a Log-in Screen Pin
Geodude48715-Apr-10 5:00
Geodude48715-Apr-10 5:00 
GeneralRe: Help with a Log-in Screen Pin
OriginalGriff15-Apr-10 5:37
mveOriginalGriff15-Apr-10 5:37 
GeneralRe: Help with a Log-in Screen Pin
Geodude48715-Apr-10 8:06
Geodude48715-Apr-10 8:06 
QuestionStrange problems with inherited user controls when using DILImport Pin
chrisclarke1114-Apr-10 6:49
chrisclarke1114-Apr-10 6:49 
AnswerRe: Strange problems with inherited user controls when using DILImport Pin
kevinnicol14-Apr-10 8:47
kevinnicol14-Apr-10 8:47 
GeneralRe: Strange problems with inherited user controls when using DILImport Pin
chrisclarke1114-Apr-10 21:27
chrisclarke1114-Apr-10 21:27 
QuestionCSV file based on timer event Pin
mprice21414-Apr-10 6:15
mprice21414-Apr-10 6:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.