Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing configuration settings in web.config or database

What it best location to store various configuration settings of a web site modules.

Creating class (that inherit ConfigurationSection) that map the settings in web.config file?
Or creating some DAL and BLL clases that work with database?

like image 881
luppi Avatar asked Feb 15 '10 15:02

luppi


People also ask

Is it better to keep configurations in config file or database?

The bottom line is that if it's a large scale distributed environment, database is the way to go unless you have automated config file management system in place. Keep light-weight config files which rarely change for essentials such as environment-info service to retrieve connection strings or session parameters.

Where does configuration settings are placed in a web application?

The Web. config file is in the root directory of an ASP.NET application. The Web. config file specifies configuration information that is specific to the application.

Which settings are stored in Web config file?

config file contains default and the machine-specific value for all supported settings. The machine settings are controlled by the system administrator and applications are generally not given access to this file. An application however, can override the default values by creating web. config files in its roots folder.

Where the configuration files are stored in your application?

These config files are typically placed under separate root directory than the rest of application code. For example, in case of Java they are typically under src/main/resources .


1 Answers

I've used a simple heuristic to categorize each configuration variable into one of four categories:

  1. Compile time configuration (changes done together with code changes) - if possible then inside the code or assembly (as an embedded resource), otherwise in web.config
  2. Server instance specific configuration (SQL connection strings, local file paths) - in web.config
  3. Application (database) configuration (feature selection and other global application settings that change rarely, if ever) - in database but without an UI
  4. Application configuration - in database, accessible through an admin UI
like image 193
Pent Ploompuu Avatar answered Oct 19 '22 03:10

Pent Ploompuu