移除对继承的节和节组的引用。
configuration 元素(常规设置架构)??configSections 元素(常规设置架构)
????configSections 的 remove 元素(常规设置架构)
??????configuration 元素(常规设置架构)
????????configSections 元素(常规设置架构)
??????????configSections 的 sectionGroup 元素(常规设置架构)
????????????configSections 的 remove 元素(常规设置架构)
<remove name="section name" /> |
属性和元素
下面几部分描述了属性、子元素和父元素。
属性
属性 | 说明 |
---|---|
name |
必选的 指定要移除的节或节组的名称。这与添加该引用的 section 或 sectionGroup 元素中的 name 属性相同。 |
子元素
无。
父元素
元素 | 说明 |
---|---|
configuration |
指定公共语言运行库和 .NET Framework 应用程序所使用的每个配置文件中均需要的根元素。 |
configSections |
指定配置节和命名空间声明。 |
sectionGroup |
定义配置节处理程序与配置节之间的关联。 |
备注
remove 元素移除对继承的节或节组的引用。可通过使用 section 和 sectionGroup 元素向当前配置文件中的集合添加新的节和节组。
如果配置文件在处理程序引用被移除后尝试使用配置节,ASP.NET 将发出服务器错误“无法识别的配置节 element_name”。
示例
下面的代码示例演示如何使用应用程序配置文件的 remove 元素来移除先前在 Machine.config 文件中定义的节。
下面的 Machine.config 文件代码声明一个名为 sampleSection
的节。
? | ![]() |
---|---|
<configuration> <configSections> <section name="sampleSection" type="System.Configuration.SingleTagSectionHandler" /> </configSections> <sampleSection setting1="Value1" setting2="value two" setting3="third value" /> </configuration> |
下面的示例应用程序配置文件代码移除 sampleSection
节。移除之后,应用程序将无法检索 sampleSection
中的设置。如果配置文件在处理程序引用被移除后尝试使用配置节,ASP.NET 将发出服务器错误“无法识别的配置节 element_name”。
? | ![]() |
---|---|
<configuration> <configSections> <clear/> <section name="anotherSection" type="System.Configuration.NameValueSectionHandler" /> </configSections> </configuration> |
元素信息
配置节处理程序 |
不适用。 |
配置成员 |
|
可配置的位置 |
Machine.config 根级别的 Web.config 应用程序级别的 Web.config 虚拟或物理目录级别的 Web.config |
要求 |
Microsoft Internet 信息服务 (IIS) 版本 5.0、5.1 或 6.0 .NET Framework 版本 1.0、1.1 或 2.0 Microsoft Visual Studio 2003 或 Visual Studio 2005 |
请参见
参考
configSections 元素(常规设置架构)configSections 的 sectionGroup 元素(常规设置架构)
configSections 的 section 元素(常规设置架构)
configSections 的 clear 元素(常规设置架构)
configuration 元素(常规设置架构)
概念
其他资源
常规配置设置 (ASP.NET)ASP.NET 配置设置
