Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another windows service question 1

Status
Not open for further replies.

dinger2121

Programmer
Sep 11, 2007
439
US
Is it possible to add properties to configure a windows service once it is installed.
I have a windows service with a timer control that retrieves data on a set interval. I would like to be able to change the interval without recompiling the service.
Can this be done?

Thanks for any thoughts.
 
use an app.config file. with an appsettings key. parse the key from config file when the service starts.

i think you can also pass startup parameters to the Program.Main(string[]) and parse them that way. I haven't done this. I just use an app.config.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
int interval = int.Parse(ConfigurationManager.AppSettings["MyKey"]);

no matter when you will need to parse the interval if you want to change the value at runtime. Whether you use a resource file, app config, xml, statup.ini or some other text file.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
I was able to get it working...I used
ConfigurationSettings.AppSettings["TimerInterval"]


Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top