Microsoft KB Archive/311091

= BUG: Configuration Section Tags Are Not Recognized =

Article ID: 311091

Article Last Modified on 5/8/2007

-

APPLIES TO


 * Microsoft ASP.NET 1.0
 * Microsoft ASP.NET 1.1

-



This article was previously published under Q311091



SYMPTOMS
If you add configuration section tags before the  configuration section in the Machine.config file, you may receive the following error message when you run your ASP.NET applications:

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parse Error Message: Unrecognized configuration section 'tagname'



CAUSE
The  section in the Machine.config file defines the configuration sections that can be used for the given configuration hierarchy within an application. If you use a configuration section tag before the  section (for example, the or  tag), you receive the above-mentioned error message because the configuration section handler has not yet been loaded.

This problem can also occur if the configuration section does not exist or if the configuration section handler is not defined.



RESOLUTION
To work around this problem, add the configuration section tag after the  section.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
This problem does not occur when you add a configuration section tag to the Web.config application configuration file because the Machine.config file in which the handler is defined for this section has already been processed.

Steps to Reproduce the Behavior
 Open the Machine.config file in Notepad. Machine.config is typically located in \WINNT\Microsoft.NET\Framework\\CONFIG\.  Move the following <appSettings> code block so that it appears before the <configSections> section: <appSettings> <add key=&quot;XML File Name&quot; value=&quot;myxmlFileName.xml&quot;/> </appSettings> </li> Save your changes to Machine.config.</li> View any existing .aspx page. You receive the above-mentioned error message.</li> Move the <appSettings> code block to the end of Machine.config just before the section, and save your changes to Machine.config.</li> View an existing .aspx page. You no longer receive the error message.</li></ol>

<div class="references_section">