
Scope of Configuration Settings
There are different scopes to configuration settings — some have a global scope, some are effective only to the scope of the application, the root Web.config file, or the Machine.config file.
The scope of a configuration section is defined in the allowDefinition attribute of the section Element for configSections (General Settings Schema) element in the Machine.config file for all sections that are included with ASP.NET. For example, the authentication Element (ASP.NET Settings Schema) element has an allowDefinition attribute of the MachineToApplication element. This means that the authentication element can be set in the Machine.config file, the root Web.config file, and a Web.config file at the application level. If it is set at the subdirectory level, an error is thrown. If there is no allowDefinition attribute defined for a section, then the default value is Everywhere.
The scope of a configuration setting is listed for each element in ASP.NET Configuration Settings and General Configuration Settings (ASP.NET), in the Element Information table next to Configurable Locations.
The following table lists the level at which each file is located in the configuration hierarchy, the file name, and a description of the important inheritance characteristics of each file.
Configuration level
|
File name
|
File description
|
|---|
Server
|
Machine.config
|
The Machine.config file contains the ASP.NET schema for all of the Web applications on the server. This file is at the top of the configuration merge hierarchy.
|
Root Web
|
Web.config
|
The Web.config file for the server is stored in the same directory as the Machine.config file and contains default values for most of the system.web configuration sections. At run time, this file is merged second from the top in the configuration hierarchy.
|
Web site
|
Web.config
|
The Web.config file for a specific Web site contains settings that apply to the Web site and inherit downward through all of the ASP.NET applications and subdirectories of the site.
|
ASP.NET application root directory
|
Web.config
|
The Web.config file for a specific ASP.NET application is located in the root directory of the application and contains settings that apply to the Web application and inherit downward through all of the subdirectories in its branch.
|
ASP.NET application subdirectory
|
Web.config
|
The Web.config file for an application subdirectory contains settings that apply to this subdirectory and inherit downward through all of the subdirectories in its branch.
|
Client application directory
| ApplicationName.config
|
The ApplicationName.config file contains settings for a Windows client application (not a Web application).
|
The ProcessModel Element
One element, the processModel Element (ASP.NET Settings Schema) element, configures the processing model that is used for the server, including all of the ASP.NET applications that are on the server. Thus, processModel settings can be placed only in the Machine.config file, and they cannot be overridden by settings in any Web.config file.
Changes to the processModel element take effect only when the worker process is restarted, not immediately after the setting is changed as with other configuration elements.
Note: |
|---|
When ASP.NET is running under Internet Information Services (IIS) 6.0 in worker process isolation mode, the IIS 6.0 process model is used and the settings in the
processModel section of the Machine.config file are ignored. To configure the process identity, cycling, or other process model values, use IIS Manager to configure the IIS worker process for your application. ASP.NET 2.0 will not run when you configure IIS 6.0 to run ASP.NET in IIS 5.0 isolation mode.
|