We noticed the Application_Start in the Global asax is no longer hit after the upgrade to Sitecore 8.2.

Does anyone have an idea what may have caused this?

My global.asax.cs:

public class Global : Sitecore.Web.Application
    protected void Application_Start()
        // some code


<%@ Application Codebehind="Global.asax.cs" Inherits="[namespace].Global" Language="C#" %>


In order to be sure the Application_Start is not hit I did a few tests:

  • Added a System.Diagnostics.Debugger.Break();
  • Edited the Global.asax file while the debugger was attached
  • Threw an exception

None of the above were successful.

The target framework is set to 4.6

  • Are you sure it's not hit? Can easily go wrong, if you're relying on attaching a debugger to see a breakpoint get hit. stackoverflow.com/questions/967813/… – Mark Cassidy Nov 8 '16 at 10:33
  • 1
    Yes, I added a System.Diagnostics.Debugger.Break() which did not work. Then changed the global.asax while the debugger was attached and even threw an exception to make sure it's not hit. – Nico Grms Nov 8 '16 at 10:36
  • 1
    Right. Hmm. And you've changed your build target to .NET 4.5.2? – Mark Cassidy Nov 8 '16 at 10:36
  • The target framework is set to 4.6 – Nico Grms Nov 8 '16 at 10:41
  • @NicoGeeroms You're probably not restarting the app completely. Detach the debugger, then stop the application pool in IIS, then start it again. See if Application_Start is executed then. Don't use exceptions to check if it's executed (you won't necessarily see them and the app will start anyway). Instead, use Debugger.Break() or write to a file on disk, or something similar. – Dmytro Shevchenko Nov 8 '16 at 10:51

It is best practice to not modify the global.asax file. Best to use the Sitecore pipelines to accomplish the same task. This allows you to follow Helix more closely and makes upgrading the site simpler.

using System.Web.Mvc;
using System.Web.Routing;
using Sitecore.Pipelines;

namespace YourApp.Pipelines.Initialize
    public class RegisterApiRoutes : Sitecore.Mvc.Pipelines.Loader.InitializeRoutes
        public override void Process(PipelineArgs args)
           // app start here

Then your config

    <processor type="YourApp.Pipelines.Initialize.RegisterApiRoutes, YourApp" />

Other Global.asax functions https://laubplusco.net/global-asax-sitecore-pipelines/

| improve this answer | |
  • How one should decide which to use between Pipelines.Loader.InitializeAspNetMvc, Pipelines.Loader.InitializeControllerFactory, Pipelines.Loader.InitializeDependencyResolver, Pipelines.Loader.InitializeGlobalFilters, Pipelines.Loader.InitializeRoutes? Which gets executed first? – Francesco Gallarotti Nov 10 '16 at 9:48
  • 3
    You can see the order in /admin/showconfig.aspx. Look for the processors with the types you stated above. . Its InitializeAspNetMvc, InitializeGlobalFilters, InitializeDependencyResolver, InitializeControllerFactory and finally InitializeRoutes. Each processor assists in a different part of the MVC initialization. – Chris Auer Nov 10 '16 at 14:34

The Application_Start method of Sitecore.Web.Application has been made internal in 8.2 which is why you cannot override it and your method is not being hit.

internal void Application_Start(object sender, EventArgs args)

You will have to use the initialize pipeline as mentioned by dnstommy, which is also best practice.

| improve this answer | |
  • 6
    Sitecore Support confirmed that making Application_Start internal is a bug and has been registered with reference #126372. – Nico Grms Nov 14 '16 at 15:00

You may need to check if your Global asax inherits from Sitecore.Web.Application

<%@ Application Codebehind="Global.asax.cs" Inherits="Sitecore.Web.Application" Language="C#" %>
| improve this answer | |
  • 1
    Could you expand on this answer? Right now it doesn't really help with why this would fix the issue the question is asking. The answer should also contain some additional information that would make it stand out as a separate answer from the other answers (especially the one that was marked as the fix) – Patrick Barron Dec 4 '17 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.