Aug 6, 2015

ASP.NET Site failed starting up, see full details for more info. System.Web.HttpException (0x80004005): Unrecognized configuration section log4net.

Guys,

If you are using log4net in your asp.net website, you may encounter the below error

System.Web.HttpException (0x80004005): Unrecognized configuration section log4net. (C:\Users\madpu02\Documents\My Web Sites\WebMatrixRemote\moresharepoints\web.config line 42) ---> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section log4net. (C:\Users\madpu02\Documents\My Web Sites\WebMatrixRemote\moresharepoints\web.config line 42)
   at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)
   at Microsoft.WebMatrix.Editor.CBMWrapper.HandleExceptionAndReturnEmptyArray(Exception ex, Boolean throwOnHttpException)
   at Microsoft.WebMatrix.Editor.CBMWrapper.GetReferences()
   at Microsoft.WebMatrix.Editor.Roslyn.ProjectSystemImpl.CbmAppDomainStarted(Object sender, EventArgs e)

The reason for this error is  the asp.net websites requires a log4net config section in web.config file.

Resolution : Add the log4net section in Config Sections of the webconfig .

 <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>  
</configSections>


For Asp.Net WebApplications(not websites) this is not required.

No comments:

Post a Comment