In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the hierarchical structure of ASP.NET configuration file and the example analysis of inheritance, which is very detailed and has certain reference value. Friends who are interested must read it!
You can distribute ASP.NET configuration files throughout the application directory to configure ASP.NET applications in an inheritance hierarchy. Using this structure, you can implement the level of configuration details required by the application at the appropriate directory level without affecting the configuration settings at the higher directory level.
ASP.NET profile configuration structure
ASP.NET configuration files are called Web.config files, and they can appear in multiple directories in ASP.NET applications. The ASP.NET configuration hierarchy has the following characteristics:
Use the profile that applies to the resources in the directory where the profile is located and all its subdirectories.
Allows you to place configuration data where it will have the appropriate scope (the entire computer, all Web applications, a single application, or a subdirectory in that application).
Allows you to override configuration settings that are inherited from a higher level in the configuration hierarchy. It also allows you to lock configuration settings to prevent them from being overridden by lower-level configuration settings.
Organize the logical groups of configuration settings into sections.
ASP.NET profile configuration inheritance
All .NET Framework applications inherit basic configuration settings and default values from a file called systemroot\ Microsoft .NET\ Framework\ versionNumber\ CONFIG\ Machine.config. The Machine.config file is used for server-level configuration settings. Some of these settings cannot be overridden in configuration files that are lower in the hierarchy.
.net client applications (console and Windows applications) use a configuration file named ApplicationName.config to override inherited settings. The ASP.NET application uses a configuration file named Web.config to override inherited settings.
The root of the ASP.NET configuration hierarchy is a file called the root Web.config file, which is located in the same directory as the Machine.config file. The root Web.config file inherits all settings in the Machine.config file. The root Web.config file includes settings that apply to all ASP.NET applications running a specific version of .NET Framework. Because each ASP.NET application inherits the default configuration settings from the root Web.config file, you only need to create a Web.config file for settings that override the default settings.
Inheritance in ASP.NET profile collection elements
Some configuration elements are collections, such as namespaces elements and customErrors elements.
In a collection, you typically add configuration settings to the collection through the add child element, remove the configuration settings through the remove child element key name, or you can clear the entire collection through the clear child element. Unless duplicates are allowed, the settings added in the child profile override the settings of the same key name in the parent profile.
Considerations for ASP.NET profile
Some collections that existed in earlier versions of .NET Framework use different element names for add child elements. For example, the customErrors element uses error child elements to add custom errors to the collection.
If you receive a request for a file that does not exist in the SubDir1 directory, ASP.NET starts searching for the configuration hierarchy, starting with the most local Web.config file, which, if present, may be in the current directory or in the parent directory of the current directory. ASP.NET will search for the error element (ASP.NET setting schema) element of customErrors where the statusCode attribute is equal to "404". Once ASP.NET finds a 404 error in the configuration settings, the URL in the redirect property is returned as a response.
ASP.NET configuration file hierarchy and inheritance related information to you here, I hope to help you understand the ASP.NET configuration file hierarchy and inheritance.
The above is all the content of the article "sample Analysis of ASP.NET profile hierarchy and inheritance". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.