David
David

Reputation: 513

Is it possible to have multiple services or applications share one single config file

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?

Upvotes: 3

Views: 431

Answers (3)

Oded
Oded

Reputation: 499382

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...

Upvotes: 2

Darin Dimitrov
Darin Dimitrov

Reputation: 1039508

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.

Upvotes: 2

Related Questions