Try our conversational search powered by Generative AI!

Dev-site often crash when build


3 out of 4 times when i build my project, I get NullReferenceException on all pages. This only happens on my dev-environment, but it's really annoying. Anyone who has a solution?

[NullReferenceException: Object reference not set to an instance of an object.]
   EPiServer.Data.DataInitialization.InitializeCacheProvider(CacheProvider cacheProvider) +367
   EPiServer.Data.DataInitialization.Initialize(InitializationEngine context) +209
   EPiServer.Framework.Initialization.ModuleNode.Execute(Action a, String key) +63
   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.Global..ctor() +103
   FID.Core.Global..ctor() +40
   FID.Global..ctor() +40
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\229e38c1\db99c0d4\App_global.asax.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +117
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +247
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +106
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +12738733
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +83
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +315
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11700896
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4869125
Dec 19, 2012 8:23

Feels like this getting worse and worse for every day. Anyone with the samre issue, getting really annying.

Dec 21, 2012 10:58


We're reporting a bug for this to investigate. Do you have any idea what can be causing this to help us track the issue?

Dec 21, 2012 11:07

One thing you can try is to set web.config setting optimizeCompilations="false" on compilation element.

Dec 21, 2012 11:09

I have a feeling that the issue appear if I'm too quick sending the first request after rebuild. The issue might be less common if I wait a couple of seconds before I refresh my browser. I'm not sure about this, it's just a feeling I've got. But once the exception's been thrown, the site is "stuck" with this. Need to either resave web.config or rebulid the project, and it might work after that

Tried to set optimizeCompilations="false", but no difference.

Dec 21, 2012 11:20

Another thing you could try is to add explicit configuration for in your web.config. That is add below line to configSections

<section name="episerver.dataStore" type="EPiServer.Data.Configuration.EPiServerDataStoreSection, EPiServer.Data" />

and then the following block in your web.config file

<dataStore defaultProvider="EPiServerSQLServerDataStoreProvider">
<add name="EPiServerSQLServerDataStoreProvider" description="SQL Server implementation of Data Store" type="EPiServer.Data.Dynamic.Providers.SqlServerDataStoreProvider, EPiServer.Data" connectionStringName="EPiServerDB" />
<cache defaultProvider="httpCacheProvider">
<add name="httpCacheProvider" description="Http Cache implementation for DataStore" type="EPiServer.Data.Cache.HttpRuntimeCacheProvider,EPiServer.Data.Cache" />
<add name="nullCacheProvider" description="Null Cache implementation for DataStore" type="EPiServer.Data.Cache.NullCacheProvider,EPiServer.Data" />

Dec 21, 2012 11:47

I've tested this for a couple of hours now, and it actually seems to work! Haven't got the crash since I implemented this configuration. Will test a little bit more before I mark as answer.

Just curious, have I made something wrong in my original installation?

Dec 21, 2012 13:54

I do not think you have done anything wrong. My guess is that we have a timing/race condition bug in our initialization (during initialization we run parts in parallell to speed up initialization) so that in some cases things get wrong. But I have reported a bug for it and we will investigate it.

Dec 21, 2012 15:51

Hello Johan,


I am experiencing the same issue on an staging environment, the difference is that after a few page-refresh the site comes back online.

The solution is running on EPiServer 7.1.3 


Can you please advice on the status of the bug that was reported back then?


Thanks and Regards,



Apr 21, 2014 10:40

The bug mentioned by Johan is fixed in EPiServer 7 Patch 4.

Bug #99523: Site throws a NullReferenceException on start up occassionally

Apr 21, 2014 20:12

Hello Toni,


Thank you for your prompt reply.

Currently the solution is running on Release 7.1.3, should we still install the patch for Release 7?

If so, can you please advise what is the difference between Release 7 Patch X and Release 7.X.Y.  


Best Regards,

Edited, Apr 22, 2014 3:53

Information about patch 4 can be found here:

Apr 22, 2014 8:30

Hello Linus,


Sorry if I was not clear in the first post. I think the question is: Are Release 7.1.3 and Release 7 Patch 4 related in any way?

  • Are fixes of Release 7 Patch 4 included in the Release 7.1.3?
  • Is there any overlap of dlls between Release 7 Patch 4 and Release 7.1.3


Apr 22, 2014 8:34

Thanks for the clarification. There is no overlap of assemblies between 7.1 and patch 4. EPiServer 7.1 has UI updates (and bug fixes) while patch 4 fixes a bunch of bugs in the core.

Apr 22, 2014 8:38


So to get the latest and greatest of EPiServer 7 as of now, the solution should be using:

EpiServer 7.1.4  and EPiserver 7 Patch 4.


Thanks and Regards,

Apr 22, 2014 8:39

Yes, unless you want to upgrade to EPiServer 7.5, that should be the case.

Apr 22, 2014 8:41
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.