what are the different types of configuration files?

Please explain me the different types of configuration files present in asp.net.

Last updated:1/20/2020 12:59:32 AM

1 Answers

Nishi Tiwari
Nishi Tiwari

Different types of Configuration files

  •  Machine.config - Server or may called as machine-wide configuration file
  • Web.config - Application configuration files which mainly deals with a single application

Machine.config File

Configuration file is applied to an executing site based on a hierarchy. There is a global configuration file for all sites in a given machine which is known as Machine.config. This file is always found in the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG directory.

The Machine.config file usually contains settings for all sites running on the machine provided by another .config file and further up the chain does not override any of these settings. Although Machine.config provides a global configuration option, we can use .config files inside individual website directories to provide more granular control over the sites. Between these two poles we can set a number of other .config files with varying degree of applicable scope.

Application Configuration file (Web.config)

Each and Every ASP.NET application had its own copy of configuration settings stored in a file known as Web.config. If the web application use multiple folders, each sub folder has their own Web.config file which inherits or overrides the parent's file settings.

  • The behavior of the ASP.NET application is affected by different settings in the configuration files:
  •  machine.config
  • web.config

The machine.config file mainly contains default and the machine-specific value for all different supported settings. The machine settings is controlled by the system administrator and applications are usually not given access to this file.

An application however, may override the default values by creating web.config files in its roots folder. The web.config files are the subset of the machine.config file.

If an application contains child directories, it can be define a web.config file for each folder. Scope of every configuration file is determined in a hierarchical top-down manner.

Any web.config file can be locally extend, restrict, or override any settings defined in the upper level.

Visual Studio generates a default web.config file for each and every project. An application may execute without a web.config file, however, we cannot debug an application without a web.config file.

At the top of the all hierarchy sits the Machine.Config file, which defines the settings that are global to a particular machine. These files are located at the following path:

\WINNT\Microsoft.NET\Framework\[Framework Version]\CONFIG\machine.config

We can also override settings in the Machine.Config file for all the applications in a particular Web site by placing the Web.Config file in the root directory of the Web site as follows:


This optional file may applies to all applications (virtual directories) for the particular Web site. If we don't include it, all the settings from the Machine.Config file apply.

We can also place a Web.Config file in the root directory of any particular application—in other words we can say in the root directory of a particular virtual directory. The following Web.Config file may applies to all pages within the application:


Finally, we can place a Web.Config file in any subdirectory of an application. These files then applies to any pages located in the same directory or any subdirectories.

what are the different types of configuration files?