Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Windows Service App

Windows Service App

Scheduled Pinned Locked Moved C#
comhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    japanreddy
    wrote on last edited by
    #1

    I have written a couple of windows services apps. when I test them they run fine and do what they are supposed to do. But after a couple of days or so, they are still running but do not perform the tasks. Any suggestions, if what could be causing it ! Would really appreciate any help. Vinayak Katkam japanreddy@yahoo.com

    H 1 Reply Last reply
    0
    • J japanreddy

      I have written a couple of windows services apps. when I test them they run fine and do what they are supposed to do. But after a couple of days or so, they are still running but do not perform the tasks. Any suggestions, if what could be causing it ! Would really appreciate any help. Vinayak Katkam japanreddy@yahoo.com

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Make sure you're cleaning up code. If you use any IDisposable implementations (ADO.NET connections and commands are a good example), make sure you call Dispose on them when finished. It's a good idea to using a using block to make sure resources are released:

      using (SqlConnection conn = new SqlConnection(...))
      {
      // More code; now even if an exception occurs, the connection is disposed
      // and managed and unmanaged resources - most important - are released
      // immediately.
      }

      It's also a good idea to instrument your service (using the Event Viewer, WMI events, etc.) so that you know what's going on. Obviously this would be a hard problem to debug (given the amount of time before things start going haywire), so instrumenting your app and responding to events will let you know when a problem starts. Read some of the exception management and instrumentation blocks in the MSDN Patterns and Practices[^] section.

      Microsoft MVP, Visual C# My Articles

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups