当前位置:编程学习 > asp >>

ASP.NET杂谈-一切都从web.config说起(2)(ConfigSections详解-上 )

 

ConfigSections的结构


--------------------------------------------------------------------------------

首先我们先回顾一下ConfigSections的结构和它子节点的说明,如下:

   1:  <configSections>
   2:        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
   3:          <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
   4:            <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
   5:                     requirePermission="false" allowDefinition="MachineToApplication"/>
   6:            <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
   7:              <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
   8:                       requirePermission="false" allowDefinition="Everywhere" />
   9:              <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
  10:                       requirePermission="false" allowDefinition="MachineToApplication" />
  11:              <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
  12:                       requirePermission="false" allowDefinition="MachineToApplication" />
  13:              <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
  14:                       requirePermission="false" allowDefinition="MachineToApplication" />
  15:            </sectionGroup>
  16:          </sectionGroup>
  17:        </sectionGroup>
  18:      </configSections> 


ConfigSectins属性和子节点说明    


--------------------------------------------------------------------------------

属性

    无。

子节点说明:

节点名称

功能描述

sectionGroup

定义配置节处理程序与配置节之间的关联。

section

定义配置节处理程序与配置元素之间的关联。

我们不难发现ConfigSectings主要包含SectiongGroup和Section两个子节点,下面就介绍一下这两个节点的属性说明:

1、sectionGroup属性说明

 


属性名称

功能描述

name

指定与下面 type 属性指定的配置节处理程序关联的配置节或元素的名称。

type

指定用来执行如下操作的配置节处理程序类的名称:处理在 name 属性中指定的节或元素中的配置设置。使用以下格式:

type=" Fully qualified class name , assembly file name , version , culture , public key token ",定义必须匹配程序集引用。

程序集文件必须与定义它的 Web.config 文件位于同一个应用程序目录中。

SectionGroup中还是可以在包含多个SectionGroup和Section。

 

 

2、section属性说明


属性名称

功能描述

name

指定与 type 属性中指定的配置节处理程序关联的配置节或元素的名称。

type

指定用来执行如下操作的配置节处理程序类的名称:处理在 name 属性中指定的节或元素中的配置设置,格式和上面sectionGroup属性中的type格式相同。

requirePermission

指定是否得到相关的配置部分要求存取权限信息。可选的 Boolean 属性。

restartOnExternalChanges

指定在该节的配置数据发生更改时是否应当重新启动应用程序,不适用于 ASP.NET 应用程序,可选的 Boolean 属性。

补充:Web开发 , ASP.Net ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,