newbies question

  • Thread starter Thread starter Henry Chen
  • Start date Start date
H

Henry Chen

We have a few windows services written in .net that run on a server. Each
service has a configuration file. Most part of the configuration files are
the same. Each time a configuration file changes, we have to change all the
configuration files. I would like to merge all configuration files into one
and put it into a central place. Is it possible? If yes, then how to do it?

Thx in advance
Henry
 
Not such a newbie question. The issue is how
a "configuration" file works. Used in strictly .NET terms
it is the app.config file that gets renamed
to "application.exe.config" when the app is deployed.
Using this type of configuration file you cannot do what
you want it to do (unless you deploy all of the
applications in the same folder). Barring that, the other
way to do this is the following:
1. Create a configuration class that has all of the
properties you want to be able to change settings for.
2. Create another class that can serialize/deserialize
this class into XML.
3. When each of the services starts up (the configuration
class should be in all of the services) have the service
open this file, deserialize it and close the file - now
you'll have the same information in all the services.

For more info on the serialize/deserialize process see
the MSDN section XML.Serialization

Jeff Levinson

Author of "Building Client/Server Applications with
VB.NET: An Example Driven Approach"
 
Back
Top