自定义了一个配置节,通常需要指定它的处理函数

<configuration>  
        <configSections>  
              <sectionGroup   name="myGroup">  
                    <sectionGroup   name="nestedGroup">  
                          <section   name="mySection"   type=  
                                "System.Configuration.NameValueSectionHandler,System"/>  
                    </sectionGroup>  
              </sectionGroup>  
        </configSections>  
   
        <myGroup>  
              <nestedGroup>  
                    <mySection>  
                          <add   key="key_one"   value="1"/>  
                          <add   key="key_two"   value="2"/>  
                    </mySection>  
              </nestedGroup>  
        </myGroup>  
  </configuration>  


具体的显示代码是:  
  NameValueCollection   config   =   (NameValueCollection)  
        ConfigurationSettings.GetConfig("myGroup/nestedGroup/mySection");  
  Response.Write("The   value   of   key_one   is   "   +   config["key_one"]   +   "<br>");  
  Response.Write("The   value   of   key_two   is   "   +   config["key_two"]   +   "<br>");  


但在运行的时候会出现:  
  分析器错误信息:   创建节处理程序时发生异常。  
   
  源错误:    
   
   
  行   4:                 <sectionGroup   name="myGroup">  
  行   5:                       <sectionGroup   name="nestedGroup">  
  行   6:                             <section   name="mySection"   type=  
  行   7:                                   "System.Configuration.NameValueSectionHandler,System"/>  
  行   8:                       </sectionGroup>  
     
  的错误。   

  如果从.net   framework中将system.dll文件考到当前webApplication中的bin文件夹下  
  就没有问题了。  


http://topic.csdn.net/t/20060319/17/4624727.html
posted on 2007-11-30 10:46  Study  阅读(636)  评论(0)    收藏  举报