Re: Thread dont start (c#)
From: BrunoSilveira_BR (BrunoSilveiraBR_at_discussions.microsoft.com)
Date: 08/10/04
- Next message: Peter E. Granger: "Recommendations on .NET self-study or classes?"
- Previous message: Divya: "how to prevent automatic conversion of csv to xls"
- In reply to: John Saunders: "Re: Thread dont start (c#)"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 10 Aug 2004 13:31:03 -0700
Hi John,
first of all, thanks for the advice. I've implemented try catch blocks in
my code. But i still dont get any error. After change some security policies
in my server i've made the listener function to be called. but it seems that
the problem is the entrywritten event handler. I didn't see it, in the log
file.
"John Saunders" wrote:
> "BrunoSilveira_BR" <BrunoSilveira_BR@discussions.microsoft.com> wrote in
> message news:A4F8C750-5221-45BF-8529-79C853120BA1@microsoft.com...
>
> <snip>
>
> > The problem is: This application works in the windows 2000 pro and 2003
> > server, but when i try to use on my server, (windows 2000 server) the
> > thread.start method doesn't seems to work. I've created a log to debug my
> app
> > and i see that thread.start doesn't work.
>
> I don't see a single try-catch block in this code! If this code throws an
> exception, it will quietly exit, and you'll have no idea what happened.
> Instead, try this:
>
> public void entrypoint() //Main entry point for applications and services
> {
> try
> {
> Thread tl = new Thread(new ThreadStart(this.listener));
> tl.Start();
> sw.WriteLine("Thread Started at " + System.DateTime.Now.ToString() +
> ". EntryPoint reached.");
> }
> catch (Exception ex)
> {
> sw.WriteLine(ex.ToString());
> }
> finally
> {
> sw.Flush();
> }
> }
>
> protected void listener() //Starts log monitoring and event listeners
> {
> try
> {
> el.Log = "System";
> el.EnableRaisingEvents = true;
> el.EntryWritten += new
> EntryWrittenEventHandler(this.listener_insert);
> sw.WriteLine("Listener Started at " + System.DateTime.Now.ToString()
> + ". Listener reached.");
> }
> catch (Exception ex)
> {
> sw.WriteLine(ex.ToString());
> }
> finally
> {
> sw.Flush();
> }
> }
> --
> John Saunders
> johnwsaundersiii at hotmail
>
>
>
- Next message: Peter E. Granger: "Recommendations on .NET self-study or classes?"
- Previous message: Divya: "how to prevent automatic conversion of csv to xls"
- In reply to: John Saunders: "Re: Thread dont start (c#)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|