views:

97

answers:

2

Are there any apps that can show the final configuration as applied to a particular application directory? What I'm picturing is something along the lines of FireBug's CSS viewer.

Basically, it should show the equivalent single web.config file (as if you only had one), with all the values that apply to the directory in question, with each element (or even attribute) annotated with its source (the real .config file it came from).

This would greatly help deploying applications into foreign environments (eg, customer sites) where they sometimes have strange configs, that add in global includes (eg, they put the include in machine.config, instead of the web.config for that app) or have allowOverride=false, etc.

+1  A: 

None currently exist that are publicly known, however a viewer could easily be written. I would analyze reflected source of the .NET CLR regarding configuration inheritance and value determination. The code logic that calculates the final configuration for a domain is quite specific, so it makes sense no viewer currently exists for your request and this would be a good starting point for a viewer you envision.

Regarding making deployments, comparisons and editing config files easier, I personally recommend trying ASPhere. It's currently the best GUI editor for .NET config files, although it is not open source.

There are of course, additional helpful examples reading / accessing config files:

And there are special exceptions for sections, such as "processModel" settings. For more information / overview details, see:

sean2078
The ASPhere is open a file, here is ask to see whats happens including all the web.config that have been loaded before the final one. And how all together web.config have made the options that final used on the application.
Aristos
+1  A: 

If you know the config sections you are interested in then this will give you the effective settings as a class specifically for those settings. You could then cast the type and retrieve the settings that way and do the same for any sections you're interested in.

object vals = System.Configuration.ConfigurationManager.GetSection("AppSettings")

However, I don't know of any way to retrieve all of the current config sections if you want to discover all of the sections using code.

Nate Zaugg