How to manage application configuration in ASP.NET?

It's hard for me to manage the configuration of an ASP.Net application for deployment for different clients. A huge amount of different settings that require hiding takes a lot of time, and the existing setup methods are too complicated for us to put forward this responsibility to support partners.

Any suggestions on the best methods for processing this or good sources of research information?

How we do things now:

  • Various xml configuration files referenced in Web.Config, such as AppSettings.xml.
  • Configurations for specific sites are stored in two configuration files.
  • Text files containing lists of site-specific data
  • In some cases, manual one-time database changes
  • C # configuration for Windsor IOC.

The specific problems that we have are:

  • Different sites with different features, different external services that we need to talk to, and different business rules.
  • Different types of deployment (live, test, training)
  • Configuration keys are changed in different versions (added, deleted), which means that we must update all duplicate files
  • We still need to be able to change keys while the application is running.

Our current thoughts on how we can do this are as follows:

  • Move the configuration to dynamically compiled code (possibly Boo, Binsor, or JavaScript).
  • Has a specific form of merge / merge configuration: combine the default configuration with the live / test / training configuration and the site configuration
+5
3

, , " " .

, .

, , , , , Web.config config, .

( , XML), , , " ", "" /, Web.config .

/ .

: ASP.NET 4.0 (. http://blog.hmobius.com/post/2010/02/17/ASPNET-40-Part-4-Config-Transformation-Files.aspx), . , -- (. http://philbolduc.blogspot.com/2010/03/using-config-transforms-outside-web.html).

, , , , XDT , // .

+2

- , / ( /#), , , , GetString().

GetObject() ( .Net XML - "z":) , , , .

( ) , , - ... , . - (WCF ) , ...:)

- ( ), ... , memcache ( TCP/ -)...

- :

public class ConfigurationStore
{
    private static ConfigurationStore _instance = null;

    public static ConfigurationStore Instance {
        get {
        if(_instance == null)
        {
            _instance = new ConfigurationStore();
        }

        return _instance;
        }
    }

    public string GetValue(string key)
    {
        ....
    }

    public Object GetObject(string key)
    {
        ...
    }
}
0

NAnt .net .

0

All Articles