Web.config file is used to make the settings to a web application, whereas Machine.config file is used to make settings to all ASP.NET applications on a server(the server machine).
This is automatically installed when you install Visual Studio. Net.
This is also called machine level configuration file.
Only one machine.config file exists on a server.
This file is at the highest level in the configuration hierarchy.
This is automatically created when you create an ASP.Net web application project.
This is also called application level configuration file.
This file inherits setting from the machine.config
No, it is not possible to add more than 1 machine.config file. if we want to overwrite any setting than that can be achieve with the help of web.config.
Yes, and it will take the default setting from machine.config file from the machine. so web.config file is not necessary or must for running or publishing website or web application.
Web.Config Files – It is used to maintain the all type of
configuration like that Database connection and Error log
configuration and also maintain the Authenticate of user
security of the web application
Machine.config – only one file was created in your
microsoft .net folder when you installed the microsoft
So, it is used to configuration for the particular server
The main difference between Machine.config and web.config is as follows:
- Machine.config is machine level config file,means if you make any changes into this file, it will applicable for all application which exists on same machine.
- While Web.config settings only applicable for application level.This file is best place to keep your connection string and SMTP like settings and so on.