views:

633

answers:

3

Hi guys, 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>
A: 

My guess is that you've copied the code, but you have different assembly names. Posting the config will help.

I would also fully quality your type in the config (something that sample doesn't show). Something like...

<section name="MySection" type="My.Assembly.Type, My.Assembly" />
Martin Peck
Nope thats not right.I have named the assemblies correctly.Created different projects trying to do the same thing
Gary Woodfine
OK. Seeing the config section definition will help.
Martin Peck
+3  A: 

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

marc_s
Thanks will definetly have a look at these
Gary Woodfine
Give a man a fish and feed him for a day,Show him how to fish and feed him for the rest of his life .Thanks will be going through those articles carefully
Gary Woodfine
I have read thos articles downloaded the projects they run no problemWhen I try replicate the project they fail??I have no idea why
Gary Woodfine
Well, very often, it's just a matter of getting the assembly and class names 100% correct when you define the config section groups and config sections - that's caused the most trouble in my case.
marc_s
A: 

Did you ever get an answer to this? I have the EXACT problem.

Paul
I did manage to resolve this but unfortunately it was that long ago I can't remember what the solution was. This is going to sound like a real Doh! moment but I can't even remember what the project was! I do remember this post and I managed to resolve it as I do use Custom Config sections alot now. Really sorry I can't be of much help to you :-(
Gary Woodfine