back to the top
- Open the Machine.config file in a text editor such as Notepad.
The Machine.config file is located in the %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\ directory.
- In the Machine.config file, locate the configuration setting you want to override in your Web.config file. When the element is more than one line, the element starts with an
<element_name> line, and ends with
</element_name>. The element may also be self-closing and may look similar to <element_name attribute1=”option” attribute2=”option” />. Note that white space is ignored. Therefore, the element may span multiple lines. The element may be preceded by a comment. The comment is contained inside
<!-- and --> markings. The <trace> configuration element example that follows is an example of a self-closing element. The <trace> configuration element example has multiple attributes, spans multiple lines, and has a comment at the beginning.
enabled="[true|false]" - Enable application tracing
localOnly="[true|false]" - View trace results from localhost only
pageOutput="[true|false]" - Display trace ouput on individual pages
requestLimit="[number]" - Number of trace results available in trace.axd
traceMode="[SortByTime|SortByCategory]" - Sorts trace result displays based on Time or Category
- Copy the whole configuration element and any beginning comment to the Clipboard.
- Determine how the element is nested in the Machine.config file.
The Machine.config file is hierarchical, and configuration elements are nested in other elements. When you copy a configuration element from the Machine.config file to the Web.config file, you must nest that configuration element in the same element that it was copied from. To determine the element of the Machine.config file that the configuration element is contained in, scroll up in the Machine.config file until you find an element that is opened, not closed. The containing element is simple to identify because higher-level elements have less indentation.
Most ASP.NET configuration items are contained in the <system.web> element. The end of the element (</system.web>) must be placed after your configuration element.
Note the element that your configuration element is contained in. You must paste that element in the same element in the Web.config file. A configuration element may be nested in multiple elements. You must create all higher-level elements in the Web.config file.
- Close the Machine.config file and then use your text editor to open the Web.config file in the root directory of your ASP.NET application.
- Paste the configuration element between the beginning and the end of the element that you identified in step 4.
For example, if the configuration item is contained in the <system.web> element, the configuration item must be pasted immediately after the opening line of the <system.web> element and before the </system.web> closing line.
- Modify the configuration element in the Web.config file to override the Machine.config setting for that application.
This setting applies to the folder that contains the Web.config file and all subfolders.
back to the top
back to the top
Article ID: 815178 - Last Review: Mar 24, 2009 - Revision: 1