I have a solution that includes both a web and a Windows NT service application. These are of course two different projects but within the same solution. They do however share a lot of the same configuration.
Currently I have the same values in both the web.config and the app.config file. This is starting to get messy and I’d like to have a shared configuration files for both of the applications within the solution.
- Is there a problem for the web
application if the configuration
isn’t at the root level of the web
application? Are there limitations here? - Will I loose caching and
automatic recycling of the web
application if I don’t use web.config - Is it generally a bad idea to shared the configuration as described?
Well, you could “externalize” certain parts of the config’s into separate .config files, and use them from both places.
E.g. you could externalize your connection string settings like so:
and then have the “connectionString.config” file like this:
Basically, any ConfigurationSection has such a “configSource” setting, which allows you to specify an external file to use.
That way, you might be able to share common parts of the two config files.
Marc