Saturday, May 22, 2010

Configuration Files in Asp.net

Differences between Machine.config, Web.config, App.config

Machine.config

  • Machine.config file is at the highest level in the configuration hierarchy.
  • The settings of Machine.config file are applied to the whole machine.
  • Machine.config file settings are applied to all the web applications residing on the server.
  • Machine.config is created when you install ASP.NET in your machine.
  • The Machine.config file contains default and machine-specific values for all supported setting.
  • Machine setting are normally controlled by the system admin and app should never be given write access to it. Only one Machine.config file exists on a server.
  • This is also called machine level configuration file.

Web.config

  • Web.config is created when you create a web application.
  • The settings made in the Web.config file are applied to that particular web application.
  • Web.config file is to override the settings from the Machine.config file.
  • An application can override most default values stored in the Machine.config file by creating one or more Web.config files.
  • Web.config is called application level configuration file.

App.Config

  • App.Config is used for windows applications.
  • App.Config file to be created by only for user not automatically. user can create more than one App.Config file and use in the application(Windows)
  • When you build the application in vs.net, it will be automatically renamed to .exe.config and this file has to be delivered along with your application.

Machine.config is the file that has the master settings for the machine and affects not only asp.net but other .NET applications. It is advisable not to mess with it. Since the configuration settings cascade, it is advisable to use the application level web.config for app specific settings.

No comments:

Post a Comment