Windows Service crash past 20 - 30 minutes

Ricardo_mm

New member
Joined
May 29, 2012
Messages
4
Programming Experience
Beginner
Hi

I dont have much experience in VB.NET.
I have development this code (check attachment) to copy event viewer logs when one event occour with ID 51.
The service work but the same crash past 20 - 30 minutes.
Can someone help identify why the service crash?

Regards.
Ricardo Marques
 

Attachments

  • TesteRicardo.zip
    18.1 KB · Views: 40
Last edited by a moderator:
You have a timer callback that every 10 seconds starts a 'Loop forever' operation.
 
No you don't need to increase that time. What you need to do is not start infinite loops over and over. It should be fairly obvious that having multiple infinite loops is a bad thing. Having a number of infinite loops that is ever increasing should be even more obviously bad. Why exactly do you think you need an infinite loop in the first place? There are few scenarios where that's a good thing.
 
No you don't need to increase that time. What you need to do is not start infinite loops over and over. It should be fairly obvious that having multiple infinite loops is a bad thing. Having a number of infinite loops that is ever increasing should be even more obviously bad. Why exactly do you think you need an infinite loop in the first place? There are few scenarios where that's a good thing.

Hi
What i need is check event viewer (log application) for event ID 51. If appear this event i need to backup application, security and system log.
I have found this code in google search and make the change to work like windows service.
I'm not a development and i only know the basic.
Can someone help me to correct this code?

Regards.
Ricardo Marques
 
Back
Top