none
An error occurred creating the configuration section handler for comm/requestor: Could not load type

    Question

  • I have a nunit test CommTest.dll for which I have written an App.Config file

    <configuration>

    <configSections>

    <sectionGroup name="comm">

    <section name="requestor" type="Edss.Comm.Requestor.RequestConfig1, Comm"/>

    <section name ="bridge" type="Edss.Comm.Bridge.BridgeConfig1, Comm"/>

    <section name ="processor" type="Edss.Comm.Processor.ProcessorConfig1, Comm"/>

    </sectionGroup>

    </configSections>

    <comm>

    <requestor>

    <request-helpers>

    <request-helper name="HTTP" class="Edss.Comm.Requestor.HTTPRequestHelper1" assembly="Comm.dll">

    <time-out>10000</time-out>

    <url>http://localhost:7777/CommWeb/Employee.ashx</url>

    </request-helper>

    </request-helpers>

    </requestor>

    <bridge>

    <request-forwarders>

    <request-forwarder name="MQ" class="Edss.Comm.Bridge.AMDASRequestForwarder1" assembly="Comm.dll"/>

    </request-forwarders>

    </bridge>

    <processor>

    <request-processors>

    <request-processor name="EDSS_SYNC" class="Edss.Sync.Processor.SyncProcessor1" assembly="Sync.dll"/>

    </request-processors>

    </processor>

    </comm>

    </configuration>

    I have a RequestConfig1.cs class in my Edss.Comm.Requestor in the Comm.dll.

    using System;

    using System.Collections.Generic;

    using System.Text;

    using System.Configuration;

    using System.Xml;

    //using log4net;

    namespace Edss.Comm.Requestor

    {

    public class RequestorConfig1 : IConfigurationSectionHandler

    {

    //private static readonly ILog log =

    // LogManager.GetLogger(typeof(RequestorConfig1));

    public object Create(object parent,

    object context, XmlNode section)

    {

    //log.Debug("*** Entering RequestorConfig1:create ***");

    //TODO: validate Section;

    //XmlNodeList nodeList = section.SelectNodes

    // (RequestorConstants.REQUEST_HELPER);

    //section.GetElementsByTagName(RequestorConstants.REQUEST_HELPER);

    //System.Collections.IEnumerator ienum = nodeList.GetEnumerator();

    //log.Debug("*** Number of Helpers Defined: ***" + nodeList.Count);

    //log.Debug("*** Exiting RequestorConfig1:create ***");

    return new StringBuilder();

    }

    }

    }

    For some reason  I am getting this error when I try to

    object config1 = ConfigurationManager.GetSection("comm/requestor");

    and the error is

    Failures:
    1) Edss.CommTest.RequestorTest.CommRequestorTest.ProcessRequest : System.Configu
    ration.ConfigurationErrorsException : An error occurred creating the configurati
    on section handler for comm/requestor: Could not load type 'Edss.Comm.Requestor.
    RequestConfig1' from assembly 'Comm'. (C:\Dev\IBMProjects\IRS\dev\Comm1\Lib\Comm
    Test.dll.config line 4)
      ----> System.TypeLoadException : Could not load type 'Edss.Comm.Requestor.Requ
    estConfig1' from assembly 'Comm'.
       at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(St
    ring configKey, Boolean& isRootDeclaredHere)
       at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String co
    nfigKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Bool
    ean requestIsHere, Object& result, Object& resultRuntimeObject)
       at System.Configuration.BaseConfigurationRecord.GetSection(String configKey,
    Boolean getLkg, Boolean checkPermission)
       at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
       at System.Configuration.ClientConfigurationSystem.System.Configuration.Intern
    al.IInternalConfigSystem.GetSection(String sectionName)
       at System.Configuration.ConfigurationManager.GetSection(String sectionName)
       at Edss.Comm.Requestor.CommRequestor.Initialize() in C:\Dev\IBMProjects\IRS\d
    ev\Comm1\Comm1\Requestor\CommRequestor.cs:line 227
       at Edss.Comm.Requestor.CommRequestor.GetInstance() in C:\Dev\IBMProjects\IRS\
    dev\Comm1\Comm1\Requestor\CommRequestor.cs:line 83
       at Edss.CommTest.RequestorTest.CommRequestorTest.ProcessRequest() in C:\Dev\I
    BMProjects\IRS\dev\Comm1\CommTest\RequestorTest\CommRequestorTest.cs:line 43
    --ConfigurationErrorsException
       at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalCon
    figHost host, String typeString, Boolean throwOnError)
       at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactor
    y.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
       at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactor
    y.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, Factory
    Record factoryRecord)
       at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactor
    y..ctor(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
       at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(Facto
    ryRecord factoryRecord)
       at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(St
    ring configKey, Boolean& isRootDeclaredHere)

    Friday, November 17, 2006 8:57 PM

Answers

  • I had a similar issue and the cause was a typo (lowercase vs uppercase) in the class name of my configuration handler in my web config.
    Tuesday, January 23, 2007 8:28 PM

All replies

  • I had a similar issue and the cause was a typo (lowercase vs uppercase) in the class name of my configuration handler in my web config.
    Tuesday, January 23, 2007 8:28 PM
  • My mistake was to make the section directly point to the class, I also needed the package identifier.
    Thursday, August 23, 2007 5:08 PM