Hi
Can anyone tell me the difference between Web.config and Machine.config?
Thanks in Advance
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Aug 16, 2011, 1:52 AM
Web.config
ASP.NET configuration files are XML-based text files each named web.config--that can appear in any directory on an ASP.NET
Web application server. Each web.config file applies configuration settings to the directory it is located in and to all virtual child directories beneath it. Settings in child directories can optionally override or modify settings specified in
parent directories. The root configuration file WinNT\Microsoft.NET\Framework\\config\machine.config--provides
default configuration settings for the entire machine. ASP.NET configures IIS to prevent direct browser access to web.config files to ensure that their values cannot become public (attempts to access them will cause ASP.NET to return 403: Access Forbidden).
At run time ASP.NET uses these web.config configuration files to hierarchically compute a unique collection of settings for each incoming URL target request (these settings are calculated only once and then cached across subsequent requests; ASP.NET
automatically watches for file changes and will invalidate the cache if any of the configuration files change).
Machine.config
It's a base configuration file for all .NET assemblies running on the server. It specifies settings that are global to a particular machine.
Difference Web.config vs Machine.config
Web.config & machine.config both are configuration files.Web.config contains settings specific to an application where as machine.config contains settings to a computer. The Configuration system first searches settings in machine.config file & then looks in application configuration files.Web.config can appear in multiple directories on an ASP.NET Web application server. Each Web.config file applies configuration settings to its own directory and all child directories below it. There is only Machine.config file on a web server.
Priya LingePosted Aug 16, 2011, 12:36 AM
Following is diffrence the between Machine.config and Web.config file.
Machine.Config
1.One Machine.config file is shared for all ASP.NET's Application.
It is only one on the machine for each version of .NET Framework.
If we apply anything in machine.config file
then it is applied on all ASP.NET applications.
2.Only one machine.config file exists on a server/computer.
This file is at the highest level in the configuration hierarchy
3.Machine.config is automatically installed when you
install .NET Framework or Visual Studio. Net.
4.Machine.config is called machine level configuration file.
Web.Config
1. Web.config file is only for particular ASP.NET application.
each ASP.NET application has different file. One ASP.NET
application can have more than one web.config file. But only one
in one folder.
2.This is automatically created when you create an ASP.Net
web application project.
3.This is also called application level configuration file or folder
level configuration file.
4.This file inherits setting from the machine.config.
If same setting key is defined in both Machine.Config and Web.config,
the Web.Config setting is used.
Hope this will help you.
Thanks.
Jiteendra SampathiraoPosted Aug 16, 2011, 12:34 AM
Machine.config file apply settings to all ASP.NET applications.
web.config files resides in your application's root folder......
machine.config file resides in x:\