I'm noting a strange exceptions, that hangs my entire web application when it occurs. But it occurs in a random way (so, not ever).
I've a custom section in web.config, associated to a ConfigurationSection inherithed class.
I access to it in the Init method of a HttpModule,
using something like:
ConfigurationManager.GetSection("sectionname");
Sometimes it throws an exception:
An error occurred creating the configuration section handler for sectionname: Object reference not set to an instance of an object.
this is the stacktrace:
Stack trace: at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean 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.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at MyNameSpace.MySection.GetCurrentSection()
at MyNameSpace.MyHttpModule.Init(HttpApplication application)
at System.Web.HttpApplication.InitModules()
at System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers)
at System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context)
at System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context)
at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
I do not often get that exception. But when it happens my entire application is down.
So, it is a very urgent problem.
The only thing that I can thing, to justify that behavior, is that, maybe, I cannot access the ConfigurationSection in the Init, because the application is still initializing, so it has not loaded the entire web.config yet.
But, I don't understand why everything works fine when I simply edit/save the web.config, to restart the application (this is the only way I actually have to get my application running again).
sgiannone
Member
25 Points
5 Posts
An error occurred creating the configuration section handler
Dec 15, 2006 02:33 PM|LINK
Hi all,
I'm noting a strange exceptions, that hangs my entire web application when it occurs. But it occurs in a random way (so, not ever).
I've a custom section in web.config, associated to a ConfigurationSection inherithed class.
I access to it in the Init method of a HttpModule,
using something like:
ConfigurationManager.GetSection("sectionname");
Sometimes it throws an exception:
An error occurred creating the configuration section handler for sectionname: Object reference not set to an instance of an object.
this is the stacktrace:
Stack trace: at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean 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.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at MyNameSpace.MySection.GetCurrentSection()
at MyNameSpace.MyHttpModule.Init(HttpApplication application)
at System.Web.HttpApplication.InitModules()
at System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers)
at System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context)
at System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context)
at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
I do not often get that exception. But when it happens my entire application is down.
So, it is a very urgent problem.
The only thing that I can thing, to justify that behavior, is that, maybe, I cannot access the ConfigurationSection in the Init, because the application is still initializing, so it has not loaded the entire web.config yet.
But, I don't understand why everything works fine when I simply edit/save the web.config, to restart the application (this is the only way I actually have to get my application running again).
I saw that exception in Windows Event Viewer.
Thank you so much for your help.
Bye
sathakmustha...
Member
2 Points
1 Post
Re: An error occurred creating the configuration section handler
Nov 20, 2012 05:33 AM|LINK
Hi we are currently facing the same issue as like you. Is your error resolved. if it was resolved can you please give us the solution.
Thanks,
Musthafa