Tuesday, August 23, 2016

Web.Config and Machine.Config

  • Manage settings at application level.
  • XML Format
  • Visual Studio create we.config for each project (by default).
  • Application can execute without web.config, but debug cannot.
  • Changes in web.config, no need reboot the web server.
  • Sub Folder web conig can be overwrrite main web config.
  • Able to reference another config <appSettings configSource="appSettings.config" />
  1. Config Sections
    • Handle configuration section.
  2. Application Settings
    • Storing application-wide name-value pairs for read only access.
  3. Connection Strings
  4. System.Web
    • Authentication
    • Authorization
    • Caching
    • CustomErrors
    • Deployment
    • HostingEnvironment
    • Identity
    • Membership
    • Pages
    • URL Mappings
    • Web Controls
    • Web Services
    • ......
Machine.Config
  • Master configuration file on your system with a lot of default settings. 
  • The settings of Machine.config file are applied to the whole asp.net applications on your server.
  • Web.config is the file for the local settings to be applied for a website or application.
  • Each .NET Framework version has only one machine.config file , at the same time, each web application has its own web.config file.
  • The machine.config file is at the highest level in the configuration hierarchy while Web.config file is to override the settings from the machine.config file.
  • Get the Machine Config Path Response.Write(ConfigurationManager.OpenMachineConfiguration().FilePath);
  • C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config

No comments:

Post a Comment