Try our conversational search powered by Generative AI!

EpiServer.Global Application_Start isn't fired up

Vote:
 

Hi,

I've faced with the issue, that the Application_Start event in Global.asax isn't getting fired up, unless the Globlal is inherited from HttpApplication directly. Why it might happen? I tried to remove Global.asax and add a new one it's not helped. Could someone advice please?

#136948
Sep 18, 2015 13:21
Vote:
 

I'm using EpiServer 7.9.1.0 verstion.

#136967
Sep 18, 2015 14:29
Vote:
 

THis might not help you directly, but:

If you want to run code at site startup, you should use IInitializableModule or IConfigurableModule along with the InitializableModule attribute, this will ensure that EPiServer is done starting up before you run code, and will probably save you a lot of headache in the long run:

	[InitializableModule]
	[ModuleDependency(typeof(ServiceContainerInitialization), typeof(EPiServer.Web.InitializationModule))]
	public class Initializer : IConfigurableModule
	{
	}

You only need to add the attribute and interface implementations, EPiServer will scan all assemblies for this attribute and execute them in ModuleDependency order.

#136972
Sep 18, 2015 16:11
Vote:
 

Your Global.asax.cs should look something like this:

public class EPiServerApplication : EPiServer.Global
    {
        protected void Application_Start()
        {
            //Tip: Want to call the EPiServer API on startup? Add an initialization module instead (Add -> New Item.. -> EPiServer -> Initialization Module)
        }
    }

You need to inherit from EPiServer.Global

#136978
Sep 18, 2015 22:10
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.