Here is the row that gives me trouble.
Hi Marcus,
With SP3 there was some remodelling in how a EPiServer handles the initialization of the application. This was because we were fixing some bugs with enterprise installations and also a step towards making EPiServer working on IIS7 (We're not there yet but in the upcoming R2 release we'll have support for IIS7).
These changes however made it so that it's not possible to hook into the datafactory events in Application_Start. Instead we first hook into Application_FirstBeginRequest and then we have a instance of the DataFactory to work with. Something like this:
protected void Application_Start(Object sender, EventArgs e)
{
EPiServer.Global.Application_FirstBeginRequest += new EventHandler(Global_Application_FirstBeginRequest);
}
void Global_Application_FirstBeginRequest(object sender, EventArgs e)
{
EPiServer.DataFactory.Instance.SavingPage += new PageEventHandler(Instance_SavingPage);
}
void Instance_SavingPage(object sender, PageEventArgs e)
{
//Insert magic here.
}
Got a similar problem after upgrading and have no clue how to fix it:
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: EPiServer.BaseLibrary.ClassFactoryException: ClassFactory not initialized
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:
[ClassFactoryException: ClassFactory not initialized]
EPiServer.BaseLibrary.ClassFactory.get_Instance() +75
EPiServer.BaseLibrary.ClassFactory.IsRegistered(Type baseType) +11
EPiServer.CacheManager..cctor() +230
[TypeInitializationException: The type initializer for 'EPiServer.CacheManager' threw an exception.]
EPiServer.StaticCacheKey.EnsureKey() +22
EPiServer.StaticCacheKey..ctor(String keyName) +15
EPiServer.DataFactoryCache..cctor() +29
[TypeInitializationException: The type initializer for 'EPiServer.DataFactoryCache' threw an exception.]
EPiServer.DataFactoryCache.Initialize(PageStoreBase df) +0
EPiServer.DataFactory..ctor() +26
EPiServer.DataFactory.get_Instance() +45
EPiServer.Blog.BlogFactory.get_PageStoreBase() +14
EPiServer.Blog.EventHandlers.Init(HttpApplication context) +90
System.Web.HttpApplication.InitModulesCommon() +65
System.Web.HttpApplication.InitModules() +43
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +729
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289
Got the site working again. Had to remove <add name="BlogEventHandlers" type="EPiServer.Blog.EventHandlers, EPiServer.Blog" /> from web.config and now the Blogg stopped working correctly. Guess the demo package has to be updated to reflect that changes described above.
/Oskar
Hello everyone,
We've now researched this abit more indepth and discovered that both these issues (Marcus aswell as Oskars) should have worked in SP3.
There shouldn't have been necesary to change anything in global.asax.cs or in the demo package for this to work.
The problem is that we made a mistake when the code was written. We've found the error in our code and corrected it. We're building a new version of SP3 as I'm typing this that will fix it. It will be available as soon as possible.
Yes, as Marcus mentions, there is now a new build of EPiServer SP3 available via EPiServer Manager. The version is now 5.1.422.267. We recommend everyone that has version 5.1.422.266 installed to upgrade to the new version.
If you now install a new SP3 site you'll always get version 5.1.422.267.
How come EPiServer doesn't provide more information about the upgrade and installation?
I would like to know the manual steps for upgrade SP2 to SP3.
This can be fixed with a custom http module doing this:
public void Init(HttpApplication context)
{
EPiServer.Web.InitializationModule.Initialize(EPiServer.Configuration.EPiServerSection.Instance, EPiServer.Configuration.Settings.Instance);
if (!EPiServer.BaseLibrary.ClassFactory.IsRegistered(typeof(EPiServer.Diagnostics.ITransformer)))
{
EPiServer.BaseLibrary.ClassFactory.RegisterClass(typeof(EPiServer.Diagnostics.ITransformer), typeof(EPiServer.Diagnostics.DefaultTransformer));
}
}
See this post:
http://www.kulov.net/blogs/martin/2009/01/typeinitializationexception-in.html
I cannot find the Application_FirstBeginRequest event in EPiServer.Global.
Does anyone know where it is located?
This atleast works in EPiServer 5.2.375.133, I am not sure about other versions.
The event Global_Application_FirstBeginRequest is not located in EPiServer.Global but EPiServer.Web.InitializationModule
So the handler should not be registered like this
EPiServer.Global.Application_FirstBeginRequest += new EventHandler(Global_Application_FirstBeginRequest);
But rather like this
EPiServer.Web.InitializationModule.FirstBeginRequest += new EventHandler(Global_Application_FirstBeginRequest);
Hei,
I am getting the same error when upgrading the site from CMS 5 SP3 to CMS R2 SP2.
Any suggestions ?
I had to directly try the upgrade SP3 for EPiServer CMS.
Well... my site doesn't work anymore.
Does anyone have any suggestions?
Here is the error message
ClassFactory not initialized
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: EPiServer.BaseLibrary.ClassFactoryException: ClassFactory not initialized
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:
[ClassFactoryException: ClassFactory not initialized]
EPiServer.BaseLibrary.ClassFactory.get_Instance() +126
EPiServer.BaseLibrary.ClassFactory.IsRegistered(Type baseType) +8
EPiServer.CacheManager..cctor() +215
[TypeInitializationException: The type initializer for 'EPiServer.CacheManager' threw an exception.]
EPiServer.DataAbstraction.PermissionData.GetPermissionListFromCache(Permission permission) +65
EPiServer.Core.ExceptionManager.RenderHttpRuntimeError(Exception e) +978
EPiServer.Global.Global_Error(Object sender, EventArgs evt) +773
[TypeInitializationException: The type initializer for 'EPiServer.DataAbstraction.UnifiedPathInfo' threw an exception.]
EPiServer.DataAbstraction.UnifiedPathInfo.Load(String path) +0
EPiServer.FileSystem.DefaultAccessControlList..ctor(String path) +100
EPiServer.Web.Hosting.UnifiedDirectory.get_DirectoryAC() +365
EPiServer.Web.Hosting.UnifiedDirectory.QueryAccess() +42
EPiServer.Web.Hosting.UnifiedDirectory.QueryDistinctAccess(AccessLevel access) +14
EPiServer.Web.Hosting.VirtualPathVersioningProvider.GetDirectory(String virtualPath) +191
EPiServer.Web.Hosting.VirtualPathHandler.InitializeProviders(ProviderSettingsCollection providers) +332
EPiServer.Global.InitializeVirtualPathProviders() +117
EPiServer.Global.StaticInitialization() +62
EPiServer.Global.Global_BeginRequest(Object sender, EventArgs e) +119
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433