ASP.NET Runtime Error | Exception type: ConfigurationErrorsException

Deployed a site, while the users were testing the site, for a few modules the app was failing and throwing ASP.NET Runtime Error | Exception type: ConfigurationErrorsException.

Runtime Error

Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.

Accessed the site, it was working – the runtime error was only thrown for a few specific modules.

Checked the event viewer for Application Logs and found the exception below –

Event code: 3008 
Event message: A configuration error has occurred. 
Event time: 29/07/2024 11:20:11 AM 
Event time (UTC): 29/07/2024 1:20:11 AM 
Event ID: 960b1ec2a0fd4e5083615975dbffd390 
Event sequence: 138 
Event occurrence: 1 
Event detail code: 0 
 
Application information: 
    Application domain: /LM/W3SVC/1/ROOT/RT3-3-133666860049197554 
    Trust level: Full 
    Application Virtual Path: /RT3 
    Application Path: C:\Rt\Training3\ 
    Machine name: DMAN01 
 
Process information: 
    Process ID: 6056 
    Process name: w3wp.exe 
    Account name: IIS APPPOOL\RT_AppPool 
 
Exception information: 
    Exception type: ConfigurationErrorsException 
    Exception message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS. (C:\RM\RT3\app\web.config line 86)
   at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
   at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
   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)
   at System.Web.Configuration.RuntimeConfig.GetSectionObject(String sectionName)
   at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
   at System.Web.Configuration.RuntimeConfig.get_Identity()
   at System.Web.HttpContext.get_ImpersonationToken()
   at System.Web.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError)
   at System.Web.ThreadContext.SetImpersonationContext()
   at System.Web.ThreadContext.AssociateWithCurrentThread(Boolean setImpersonationContext)
   at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)
   at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)

 
 
Request information: 
    Request URL: http://RDAZ/RT3/app/InfoCentre/GetInfoCentreConfigForActiveUser 
    Request path: /RT3/app/InfoCentre/GetInfoCentreConfigForActiveUser 
    User host address: 10.124.35.8 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: IIS APPPOOL\RT_AppPool
 
Thread information: 
    Thread ID: 39 
    Thread account name: IIS APPPOOL\RT_AppPool
    Is impersonating: False 
    Stack trace:    at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
   at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
   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)
   at System.Web.Configuration.RuntimeConfig.GetSectionObject(String sectionName)
   at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
   at System.Web.Configuration.RuntimeConfig.get_Identity()
   at System.Web.HttpContext.get_ImpersonationToken()
   at System.Web.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError)
   at System.Web.ThreadContext.SetImpersonationContext()
   at System.Web.ThreadContext.AssociateWithCurrentThread(Boolean setImpersonationContext)
   at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)
   at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
 
 
Custom event details: 

Solution –

As per exception above, web.config was referring to line 86 for the section that failed to launch. It also stated, section registered as allowDefinition=’MachineToApplication’.

Checked the site repository – app folder, it contained the module which user was trying to access in the site, when the RTE exception occurred.

Accessed the site in IIS, navigated to the app folder, RMC and select ‘Convert to Application‘.

This will overcome the issue.

Leave a Reply

Your email address will not be published. Required fields are marked *