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?
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...
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.
You can load config file programmatically
And another link
精彩评论