3

If I have multiple applications or services which all share one configuration value (e.g. they all access the same database), is there a way to have them share one single config file instead of having to duplicate the values throughout each of their configs?

David
  • 493
  • 7
  • 15

3 Answers3

2

You could use the machine.config file to define settings shared between all applications on this computer. For ASP.NET applications you could have a web.config file at the root of the file which overrides those machine.config values and have yet another level inside the virtual directory.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
2

You can use the configSource attribute to point to a specific file.

Use the same file location from multiple .config files.

You can do this with multiple config sections, so one file for connection strings, one for app settings etc...

Oded
  • 489,969
  • 99
  • 883
  • 1,009
0

You can load config file programmatically

And another link

Community
  • 1
  • 1
Sergey Vedernikov
  • 7,609
  • 2
  • 25
  • 27