Overview of ASP. NET configuration files (1)

Source: Internet
Author: User

Overview of ASP. NET configuration files (1)

The reason for writing this series of articles Is Jeffery Zhao. when reading the "MVC" Lecture by Lao Zhao, I remember that Lao Zhao once said: a real ASP. NET programmers should configure the file web. config should be very skilled and have a good understanding of the node related to the configuration file. There are a lot of existing ASP. NET books only use controls and so on, and some existing reference documents only talk about how to use the configuration node, rarely detail the configuration file (note: old Zhao's original words are not like this :). So here I wrote this series of articles boldly, and I hope you will forgive me for any defect!

 

First, let's look at the inheritance level of the configuration file. We all know that there are many configuration files in ASP. NET, such as machine. config, web. config, and especially web. config, which have different roles in different places. We also know the machine. the configuration in config applies to all ASP. NET website, while web. the configuration in config depends on its location, such as the web in the root directory of a website. config takes effect for the entire website. config Only works for this folder, and the web in the website and directory. the configuration in config also works for this folder. This reflects another fact :. from another perspective, for a folder in a website, it is not only affected by the web in this folder. config configuration constraints, and also receive the web under the root directory of the website. config constraints, but also by the machine on the server. config constraints.

 

Next, let's take a look at the inheritance level of the configuration file in ASP. NET:

1. machine. confiig-in ASP. NET, many default configurations are defined in this configuration file, but some configurations have been removed from the machine. config is moved to another place. To shorten ASP. NET loading time. We know that you are running an ASP. NET Program, ASP. NET Runtime is to load a lot of configuration files, of course, machine. config must be loaded, but some of the configurations are not required, so it is moved to another place and loaded if used.

 

2. web. config-in % windir % \ Microsoft. NET \ Framework \ v2.0.50727 \ CONFIG configuration file, previously said machine. config removes many configurations and stores them in this configuration.

 

3. In the root directory web. config-we can also put web. config in the root directory to make it work for the entire root directory. For example, c: \ inetpub \ wwwroot. because we can create many new virtual directory folders with website programs in the folder. If we put the configuration file in the virtual directory, the configuration will take effect for the whole website in the folder.

 

4. web. config in a website-this is our most common configuration.

5. web. config in a folder on the website-we often use this configuration file to restrict access to the file.

 

The last time is the level of the configuration file. The role of the configuration file at the next level is the sum of all the configuration constraints on it. That is to say, the configuration constraints of folders in a website are machine. config + web. config +... + web and config (this statement is not very appropriate and I hope you can understand it ).

Reprinted original address: http://www.cnblogs.com/yanyangtian/archive/2009/05/28/1491227.html

Related Article

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.