What is the difference between web.config
and machine.config
?
I have read that:-
The web.config files specify configuration settings for a particular web application, and are located in the application's root directory; the machine.config file specifies configuration settings for all of the websites on the web server, and is located in $WINDOWSDIR$\Microsoft.Net\Framework\Version\Config.
Is there anything which I am missing or any other technical aspect? I want to know more about both the files.
A web. config file is a Windows file that lets you customize the way your site or a specific directory on your site behaves. For example, if you place a web. config file in your root directory, it will affect your entire site (www.coolexample.com).
The machine. config file is stored in the %WINDIR%\Microsoft.NET\Framework folder in the directory where Microsoft Windows is installed. By default, it is located in the following path: C:\WINDOWS\Microsoft.NET\Framework\v1. 1.4322\CONFIG.
You can have a web. config for each folder under your web application. app. config is used for windows applications.
Yes you can have two web. config files in application. There are situations where your application is divided in to modules and for every module you need separate configuration. For example if you have a application which has two modules lets say accounts and sales.
Each CLR version has a machine.config
file, along with an additional web.config
file, which I refer to as the "machine level web.config file".
Additionally, as you note, each web application also has a web.config
file. Directories inside a web application can also have web.config
files too.
Now, the key point is that config files inherit from each other. That means, a web application will read settings defined in the machine.config
file and the machine level web.config
file (for its given framework version), and its own web.config
file.
A common use case for defining things in the machine.config
would be to share values between many applications on the server, like a connection string perhaps, or SMTP server settings, things like that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With