When to declare windows service application settings
-
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.
-
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.
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
-
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.
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