Easy one for you .netters.
I have written a windows service in C#2010, compiled to run on x86 using 3.5.
I put all my mission critical stuff in a lib and unit tested it thoroughly.
Being a windows service, if it encounters a problem I wanted it to log to the windows event log.
All works like a charm, kindof.
Put simply, my service starts up, loads it's settings, reports to the windows event log that it is up.
Then it kicks off a System.Timer event for 60s hence.
This fires ok.
Then in the event I say something like
DoFunctionA();
LogEvent("I did a");
DoFunctionB();
LogEvent("I did b");
DoFunctionC();
LogEvent("I did c");
DoFunctionD();
LogEvent("I did d");
Everything has proper error handling and the catch blocks also log to the event log.
The output to the event log is :
I'm Up
I did A
I did B
I did C
.....
Just stops at C. The only logical place for the code to go is to exception, which is logged, or on to task D. Is does neither.
Run the windows service as a console app and it works like a trooper.
Alls I can think is that the tasks a,b,c and d are quite memory intenstive and laborious. Is there a known issues with System.Timers not liking heavy threads?
Any experince from the panel muchly appreciated.
Ta
In awe
Suity
I have written a windows service in C#2010, compiled to run on x86 using 3.5.
I put all my mission critical stuff in a lib and unit tested it thoroughly.
Being a windows service, if it encounters a problem I wanted it to log to the windows event log.
All works like a charm, kindof.
Put simply, my service starts up, loads it's settings, reports to the windows event log that it is up.
Then it kicks off a System.Timer event for 60s hence.
This fires ok.
Then in the event I say something like
DoFunctionA();
LogEvent("I did a");
DoFunctionB();
LogEvent("I did b");
DoFunctionC();
LogEvent("I did c");
DoFunctionD();
LogEvent("I did d");
Everything has proper error handling and the catch blocks also log to the event log.
The output to the event log is :
I'm Up
I did A
I did B
I did C
.....
Just stops at C. The only logical place for the code to go is to exception, which is logged, or on to task D. Is does neither.
Run the windows service as a console app and it works like a trooper.
Alls I can think is that the tasks a,b,c and d are quite memory intenstive and laborious. Is there a known issues with System.Timers not liking heavy threads?
Any experince from the panel muchly appreciated.
Ta
In awe
Suity
Comment