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
  1. Home
  2. General Programming
  3. C#
  4. When to declare windows service application settings

When to declare windows service application settings

Scheduled Pinned Locked Moved C#
tutorialquestion
3 Posts 3 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.
  • K Offline
    K Offline
    KaptinKrunch
    wrote on last edited by
    #1

    When are app config settings for a windows service initialized. During a restart event? During a Start event? During OnContinue event? During Runtime? At install time? For example: OracleConnection oConn = new OracleConnection(ConfigurationManager.AppSettings["DatabaseConnection"].ToString()); is used at the time that its needed and is working. Currently I'm not making this call or similar in any of the service events. Should I be? When are you pro's assigning windows service config options? Whats the recommended way to handle config changes? p.s. If I've posted in the wrong forum, please flame away.

    Just because we can; does not mean we should.

    N S 2 Replies Last reply
    0
    • K KaptinKrunch

      When are app config settings for a windows service initialized. During a restart event? During a Start event? During OnContinue event? During Runtime? At install time? For example: OracleConnection oConn = new OracleConnection(ConfigurationManager.AppSettings["DatabaseConnection"].ToString()); is used at the time that its needed and is working. Currently I'm not making this call or similar in any of the service events. Should I be? When are you pro's assigning windows service config options? Whats the recommended way to handle config changes? p.s. If I've posted in the wrong forum, please flame away.

      Just because we can; does not mean we should.

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      KaptinKrunch wrote:

      and is working. Currently I'm not making this call or similar in any of the service events.

      I'm confused, if your're not using it how do you know its working? If you want to monitor for changes to a file you'd use something the FileSystemWatcher. In the case of your connection string it would be read as it was accessed, and you should be using ConnectionStrings instead of AppSettings


      only two letters away from being an asset

      1 Reply Last reply
      0
      • K KaptinKrunch

        When are app config settings for a windows service initialized. During a restart event? During a Start event? During OnContinue event? During Runtime? At install time? For example: OracleConnection oConn = new OracleConnection(ConfigurationManager.AppSettings["DatabaseConnection"].ToString()); is used at the time that its needed and is working. Currently I'm not making this call or similar in any of the service events. Should I be? When are you pro's assigning windows service config options? Whats the recommended way to handle config changes? p.s. If I've posted in the wrong forum, please flame away.

        Just because we can; does not mean we should.

        S Offline
        S Offline
        Sunny Ahuwanya
        wrote on last edited by
        #3

        I'd go for the simplest solution first, which is onStart (also takes care of Restart)

        Sunny Ahuwanya "The beauty of the desert is that it hides a well somewhere" -- Antoine de Saint Exupéry

        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