After embracing the whole SOA thing, I’ve found that I’m gradually drowning in a sea of web.config and app.config files.
As an example, one system has 2 services that it interacts with. Each service has 3 config files – one for dev, one for staging and one for production. That’s 6 config files. Then each application (3 different ones) that use these services needs three config files again, that’s another 9. So that’s 15 config files just for a relatively simple system.
How can I go about simplifying my configuration? Is there a better way of doing this? Should I try to make my config files environment agnostic? Should I investigate the whole WCF Discovery? Should I use the web.config transformation syntax?
You could put the config into code instead and set different values for the environments that depend on a registry key (or something) that is set globally on each environment’s servers.
Migrating the settings from the config files to code is pretty easy (at leats I started writing WCF services using all-code configuration until the architects decided that 15 config files were the way to go… I guess it was easy for them to decide that as they didn’t have to manage them)
2
I used web.config transformation feature. [More information here.][1]
Link
You may also modify your settings programatically per environment after reading the settings from the config file.