Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App.config - custom section not working

Tags:

c#

I recently started building a console version of a web application. I copied my custom sections from my web.config. to my app.config. When I go to get config information i get this error:

An error occurred creating the configuration section handler for x/y: Could not load type 'x' from assembly 'System.Configuration

The line that it is not liking is:

return ConfigurationManager.GetSection("X/Y") as Z;

Anyone run into something like this?

I was able to add

<add key="IsReadable" value="0"/> 

in the appSettings and read it.

Addition:

I do actually have this defined about the custom section:

  <configSections>
    <sectionGroup name="x">
      <section name="y" type="zzzzz"/>
    </sectionGroup>

  </configSections>
like image 539
Brian G Avatar asked Nov 20 '08 19:11

Brian G


1 Answers

it sounds like your config-section handler is not defined

<configSection>
    <section
            name="YOUR_CLASS_NAME_HERE"
            type="YOUR.NAMESPACE.CLASSNAME, YOUR.NAMESPACE, Version=1.1.0.0, Culture=neutral, PublicKeyToken=PUBLIC_TOKEN_ID_FROM_ASSEMBLY"
            allowLocation="true"
            allowDefinition="Everywhere"
          />
</configSection>
like image 181
Steven A. Lowe Avatar answered Sep 29 '22 02:09

Steven A. Lowe