Results 1 to 6 of 6

Thread: Windows Service crash past 20 - 30 minutes

  1. #1
    Ricardo_mm is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0
    Join Date
    May 2012
    Posts
    4
    Reputation
    0

    Windows Service crash past 20 - 30 minutes

    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
    Attached Files Attached Files
    Last edited by JohnH; 05-29-2012 at 5:09 PM. Reason: removed generated binaries from attachment (bin+obj folders)

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.5
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    15,090
    Reputation
    2804
    You have a timer callback that every 10 seconds starts a 'Loop forever' operation.
    How to format posts with code blocks etc - present the problem/post properly

    Visual Studio Community 2017

  3. #3
    Ricardo_mm is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0
    Join Date
    May 2012
    Posts
    4
    Reputation
    0
    Quote Originally Posted by JohnH View Post
    You have a timer callback that every 10 seconds starts a 'Loop forever' operation.

    I need to increase that time?
    What is the standard value that i need to put?

  4. #4
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    13,814
    Reputation
    1707
    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.

  5. #5
    Ricardo_mm is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0
    Join Date
    May 2012
    Posts
    4
    Reputation
    0
    Quote Originally Posted by jmcilhinney View Post
    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

  6. #6
    Ricardo_mm is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0
    Join Date
    May 2012
    Posts
    4
    Reputation
    0
    Finally i resolve my problem with this code FreeVBCode code snippet: Capture the Entry of Items into the Event Log (VB.NET).

    Thanks for your support.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •