Try our conversational search powered by Generative AI!

NullReferenceException after building the site

Vote:
 

Hi,

I'm trying out Episerver 7 currently and getting the following exception.

 

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace: 

[NullReferenceException: Object reference not set to an instance of an object.]
   EPiServer.Common.Configuration.ConfigurationSectionBase`1.GetInstance(String sectionName) +295
   EPiServer.Common.ImplementationModule.LoadCoreConfiguration() +10
   EPiServer.Common.Settings.LoadSettings() +268
   EPiServer.Common.InitializationModule.Initialize(InitializationEngine context) +27
   EPiServer.Framework.Initialization.ModuleNode.Execute(Action a, String key) +64
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +751
   EPiServer.Framework.Initialization.InitializationEngine.Initialize(HostType hostType) +168
   EPiServer.Framework.Initialization.InitializationModule.Initialize(HostType hostType) +308
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +75
   EPiServer.Framework.Initialization.InitializationModule.Application_BeginRequest(Object sender, EventArgs e) +46
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270

 

What I was trying to configure Dynamic Content as per the following link: http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-CMS/7/Dynamic-Content/Configuring-Dynamic-Content/

 

I've added the given user control and built the site using VS 2010. Then I've got the mentioned exception. 

So, I removed the user control and the config section. But still I'm seeing the same exception. Any help would be highly appreciated.

Regards,

Thusitha

#70958
May 06, 2013 13:13
Vote:
 

I've kind of resolved this to some extent.

Created a new site and did a diff with the web.configs of the new site and the old (broken) site.

Older site is now working, however without images. Any ideas?

 

Regards,

Thusitha

#70992
May 07, 2013 7:59
Vote:
 

The error indicates that you are missing the <episerver.common> section in your web.config

 

EPiServer.Common.Configuration.ConfigurationSectionBase`1.GetInstance(String sectionName) +295
EPiServer.Common.ImplementationModule.LoadCoreConfiguration() +10
EPiServer.Common.Settings.LoadSettings() +268

#70997
May 07, 2013 9:11
Vote:
 

Probably an error in config files just like you guessed. I normally do the same thing as you did. Start with fresh config files from example sites that you know are working and change settings for VPP etc (this might be the cause of your missing images btw). Use WinMerge or similar tool to find the differences that you need to move from old config files to the new ones... This is usually faster than bashing your head against the wall trying to modify the existing if you don't locate the error right away...

#71001
May 07, 2013 9:54
Vote:
 

Hi,

Thanks for your ideas. Appreciate it. :)

 

So I encountered this error again. I was working on another new site. I was changing the ProductPageTemplate.aspx.

Built the site in Debug mode. And it happened again. Exception is as follow:

 

[NullReferenceException: Object reference not set to an instance of an object.]
   EPiServer.Common.Configuration.ConfigurationSectionBase`1.GetInstance(String sectionName) +295
   EPiServer.Common.ImplementationModule.LoadCoreConfiguration() +10
   EPiServer.Common.Settings.LoadSettings() +268
   EPiServer.Common.InitializationModule.Initialize(InitializationEngine context) +27
   EPiServer.Framework.Initialization.ModuleNode.Execute(Action a, String key) +64
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +751
   EPiServer.Framework.Initialization.InitializationEngine.Initialize(HostType hostType) +168
   EPiServer.Framework.Initialization.InitializationModule.Initialize(HostType hostType) +308
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +75
   EPiServer.Framework.Initialization.InitializationModule.Application_BeginRequest(Object sender, EventArgs e) +46
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270


Does this mean I cant build the site? I did build few times without any issue. But suddenly I get this exception again. Any ideas?

Regards,
Thusitha

#71092
Edited, May 09, 2013 11:49
Vote:
 

I have installed Episerver Communities as well. Following config sections are getting removed from web.config after building.

 

<section name="episerver.common" type="EPiServer.Common.Configuration.EPiServerCommonSection, EPiServer.Common.Configuration" />
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
<section name="episerver.community" type="EPiServer.Community.Configuration.EPiServerCommunitySection, EPiServer.Community.Configuration" />

 

Regards,

Thusitha

#71093
May 09, 2013 12:26
Vote:
 

Hi,

The root config files (including web.config) are modified by the build transforms. Try inserting the config sections in config files located under the Configuration folder instead. That way it will be included in the final web.config located in the root directory, which will be used by the site.

#77266
Nov 14, 2013 11:16
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.