3

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?

asked Jun 20, 2013 at 2:17

2 Answers 2

1

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)

answered Jun 20, 2013 at 11:21
2
  • That sounds pretty good gbjbaanb - if I don't need to change the config then I guess I don't need a config file! Any links on how to specify wcf binding settings programmatically? Commented Jun 20, 2013 at 23:41
  • @LachlanB I started with the MSDN reference and worked my way in adding the necessary bindings and contexts and security as the project progressed. You could read the tutorial that shows how to set things up in code for examples. Commented Jun 21, 2013 at 10:50
0

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.

Glorfindel
3,1676 gold badges28 silver badges34 bronze badges
answered Jun 20, 2013 at 5:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.