In this blog I am trying to explain the introduction of configuration files in C#.
Basically all configuration file are use to configure the particular application. In c# web. app file used to configure the setting of particular web application, on the other hand app. config is used to configure the windows application developed in .net, while the machine. config, it is automatically installed when you install.Net Framework. It is installed at Microsoft.NET\Framework\v1.1.4322\CONFIG. It contains default and machine-specific values for all supported setting. And only one machine. config file can exist on a server. Within this blog, many of the C# code examples assume you have both included a reference to System.Configuration.dll in your project.
The configuration system first looks in the machine configuration file for the appSettings and other configuration sections that a developer might want to define. It then looks in the application configuration file. To keep the machine configuration file manageable, it is best to put these settings in the application configuration file. However, putting the settings in the machine configuration file can make your system more maintainable. For example, if you have a third-party component that both your client and server application uses, it is easier to put the settings for that component in one place. In this case, the machine configuration file is the appropriate place for the settings, so you don't have the same settings in two different files.
web.config vs machine.config
1.This is automatically installed when you install. Net Framework.It is installed at Microsoft.NET\Framework\v1.1.4322\CONFIG. It contains default and machnine-specific values for all supported setting.
2. Only one machine.config file can exist on a server.
3. This file is at the highest level in the configuration hierarchy.
4. It’s like a common repository for standard items and it’s over ridden by web.config file.
5. Without the Machine.Config file Application cannot be executed.
1.This is automatically created when you create an ASP.Net web application project.
2.This file inherits the settings from the machine.config and can override them as required.
3.Without the Web.Config file, Application can still be executed.