Priority of the. NET configuration file

Source: Internet
Author: User
Tags server memory

When IIS is started on the Asp.net website, it loads the configuration information in the configuration file and caches the information so that you do not have to read the configuration information each time. Asp.net application during runningProgramThe configuration file changes are monitored. Once the configuration information is edited, the configuration information is read again and cached.

When we want to read information about a node or node group, we search for the information as follows:
(1) If the Web. config file exists in the directory where the current page is located, check whether the node name to be searched exists. If yes, return the result and stop searching.
(2) If the directory of the current page does not contain the web. config file or the web. config file does not contain the name, search for its parent directory until the root directory of the website.
(3) If the root directory of the website does not exist. config file or web. if the node name does not exist in the config file, it is in % WinDir % \ Microsoft. net \ framework \ v2.0.50727 \ config \ Web. search in the config file.
(4) In % WinDir % \ Microsoft. net \ framework \ v2.0.50727 \ config \ Web. if the config file does not contain any node, the node is in % WinDir % \ Microsoft. net \ framework \ v2.0.50727 \ config \ machine. search in the config file.
(5) If not found, null is returned.
Therefore, if you have specific Configuration Requirements for a website or folder, you can create a web under the corresponding folder. the Config File overwrites the web in the upper-level folder. in the config file. The configuration information can be searched only once and then cached for future calls. When the Asp.net application is running. if the config file is changed, the corresponding application will be restarted, and the user session information stored in the server memory will be lost (such as the session stored in the memory ). Each time some software (such as anti-virus software) accesses web. config, the access time attribute of Web. config is modified, and the Asp.net application is restarted.

this article from the csdn blog, reprinted please indicate the source: http://blog.csdn.net/mathewsking/archive/2009/01/13/3769025.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.