自定义配置节 [英] Custom Configuration Sections

查看:157
本文介绍了自定义配置节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在试图在一个项目我忙着和实现自定义配置节,不管我怎么努力我不断收到以下错误:

{发生错误pageAppearanceGroup / pageAppearance创建配置节处理程序:未能从程序集加载类型Samples.AspNet.PageAppearanceSection'System.Configuration,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a (E:\\三九发展\\ LastFM等\\ MSDN \\ MSDN \\ BIN \\调试\\ Samples.Aspnet.vshost.exe.config 6号线)}

我从这个MSDN Artricle复制code:

<一个href=\"http://msdn.microsoft.com/en-us/library/2tw134k3.aspx\">http://msdn.microsoft.com/en-us/library/2tw134k3.aspx

我仍然得到同样的错误。

我曾尝试在下面的文章,但无济于事所有的建议/指南。

<一href=\"http://www.evanclosson.com/devlog/bettercustomerrorsinaspnetcustomconfigurationsection\">http://www.evanclosson.com/devlog/bettercustomerrorsinaspnetcustomconfigurationsection

<一个href=\"http://geekswithblogs.net/akraus1/articles/64871.aspx\">http://geekswithblogs.net/akraus1/articles/64871.aspx

这必须是愚蠢的东西,我很想念。
我运行Vista,会是一个问题吗?一些不起眼的安全设置?

 &LT;结构&gt;
  &LT;! - 配置部分,处理程序声明区域。 - &GT;
  &LT; configSections&GT;
    &LT; sectionGroup NAME =pageAppearanceGroup&GT;
      &lt;节
        NAME =pageAppearance
        类型=Samples.AspNet.PageAppearanceSection
        allowLocation =真
        allowDefinition的=无处不在
      /&GT;
    &LT; / sectionGroup&GT;
    &LT;! - 其他&lt;节&GT;和&lt;&sectionGroup GT;元素。 - &GT;
  &LT; / configSections&GT;  &LT;! - 配置节设置区域。 - &GT;
  &LT; pageAppearanceGroup&GT;
    &LT; pageAppearance仅限远程=真正的&GT;
      &LT; FONT NAME =TimesNewRoman大小=18/&GT;
      &LT;彩色背景=000000前景=FFFFFF/&GT;
    &LT; / pageAppearance&GT;
  &LT; / pageAppearanceGroup&GT;&LT; /结构&gt;


解决方案

您也应该检查出乔恩Rista的三部分系列在.NET 2.0配置了在$ C $的CProject。

强烈推荐,写得很好,非常有帮助!

马克

I am currently trying to implement a Custom Configuration Section in a project I am busy with and no matter what I try I keep getting the error below:

{"An error occurred creating the configuration section handler for pageAppearanceGroup/pageAppearance: Could not load type 'Samples.AspNet.PageAppearanceSection' from assembly 'System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. (E:\Three Nine Developments\lastfm\msdn\msdn\bin\Debug\Samples.Aspnet.vshost.exe.config line 6)"}

I have copied the code from this MSDN Artricle:

http://msdn.microsoft.com/en-us/library/2tw134k3.aspx

I still get the same error.

I have tried the all the advice/guide in the following articles but to no avail.
http://www.evanclosson.com/devlog/bettercustomerrorsinaspnetcustomconfigurationsection

http://geekswithblogs.net/akraus1/articles/64871.aspx

This must be something stupid that I am missing. I am running Vista, could that be a problem? some obscure security setting?

    <configuration>
  <!-- Configuration section-handler declaration area. -->
  <configSections>
    <sectionGroup name="pageAppearanceGroup">
      <section
        name="pageAppearance"
        type="Samples.AspNet.PageAppearanceSection"
        allowLocation="true"
        allowDefinition="Everywhere"
      />
    </sectionGroup>
    <!-- Other <section> and <sectionGroup> elements. -->
  </configSections>

  <!-- Configuration section settings area. -->
  <pageAppearanceGroup>
    <pageAppearance remoteOnly="true">
      <font name="TimesNewRoman" size="18"/>
      <color background="000000" foreground="FFFFFF"/>
    </pageAppearance>
  </pageAppearanceGroup>



</configuration>

解决方案

You should also check out Jon Rista's three-part series on .NET 2.0 configuration up on CodeProject.

Highly recommended, well written and extremely helpful!

Marc

这篇关于自定义配置节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆