Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon Dingley 1470 posts 3427 karma points c-trib
    Jan 23, 2014 @ 21:34
    Simon Dingley
    0

    Null reference error on Umbraco.Web.UmbracoModule.BeginRequest

    I've just completed a clean install of Windows 8.1 and running a site from Visual Studio and IIS Express I can't load the site due to a null reference error on what looks to be the httpcontext. I'm running out of ideas now but think its something to do with .net early in the lifecycle as Visual Studio doesn't break into the exception:

    [NullReferenceException: Object reference not set to an instance of an object.]
       Umbraco.Web.UmbracoModule.BeginRequest(HttpContextBase httpContext) +13
       Umbraco.Web.UmbracoModule.<Init>b__5(Object sender, EventArgs e) +253
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
    

    Any ideas on what the cause/solution is?

    Cheers, Simon

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Jan 23, 2014 @ 21:44
    Ali Sheikh Taheri
    0

    Hi Simon,

    Do you have any content? if so have you tried to republish entire site? do you ave access to Umbraco or you get the same error?

    Cheers

    Ali

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Jan 23, 2014 @ 22:14
    Simon Dingley
    0

    Same error when trying to access anything including ~/umbraco. I created another bare bones site with a clean install of Umbraco and I don't have any problems which is not what I expected but might rule out anything to do with the .Net Framework or MVC.

    Simon

  • Sebastiaan Janssen 5045 posts 15477 karma points MVP admin hq
    Jan 24, 2014 @ 00:00
    Sebastiaan Janssen
    100

    Sounds like a missing global.asax file.. I've seen this before and I can't figure out how to fix it, I'm assuming you have VS13 and did file > new project and installed the Umbraco NuGet package? The only thing that helps for me is to close the solution, open it again and then it works. It's super annoying and I couldn't find any file changes between before closing the solution and afterwards.

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Jan 24, 2014 @ 09:16
    Simon Dingley
    0

    Thanks Sebastiaan, it was the Global.asax file which strangely was missing. Having looked back at the commit logs somebody had removed it from the solution so I am going to hunt them down now and give'em a slap!

    Cheers, Simon

  • Anton Oosthuizen 206 posts 486 karma points
    May 14, 2014 @ 17:31
    Anton Oosthuizen
    0

    Hi

    I get the same error. Opening and closing does not work for me.

    When I set a breakpoint on the global file it does break and I can step through but as soon as the debugger exits I receive the error

      using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Http;
    using System.Web.Mvc;
    using System.Web.Routing;
    
    namespace  u616Bootstrap3
    {
        // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
        // visit http://go.microsoft.com/?LinkId=9394801
        public class MvcApplication : System.Web.HttpApplication
        {
            protected void Application_Start()
            {
                AreaRegistration.RegisterAllAreas();
                WebApiConfig.Register(GlobalConfiguration.Configuration);
                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
            }
        }
    }
    
    
    
    
    
    Server Error in '/' Application.
    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.]
       Umbraco.Web.UmbracoModule.BeginRequest(HttpContextBase httpContext) +58
       Umbraco.Web.UmbracoModule.<Init>b__5(Object sender, EventArgs e) +320
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
    
    
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446 
    
  • Sebastiaan Janssen 5045 posts 15477 karma points MVP admin hq
    May 14, 2014 @ 19:59
    Sebastiaan Janssen
    0

    You need to remove global.asax.cs, Umbraco's Umbraco.Web.UmbracoApplication needs to kick in, which is prevented if the global.asax.cs exists. Make sure to rebuild after removing the .cs file.

  • Anton Oosthuizen 206 posts 486 karma points
    May 15, 2014 @ 07:44
    Anton Oosthuizen
    0

    Thank you.

    But how do I then, for example, register bundles to the bundletable?

  • Anton Oosthuizen 206 posts 486 karma points
    May 15, 2014 @ 07:47
  • amrut 2 posts 22 karma points
    Jan 18, 2015 @ 08:34
    amrut
    0

     As others said, it is due to the Global.asax file. you can solve this by adapting below approach.

    1. Delete Global.asax.cs file from the solution.

    2. Change the Mark up code for Global.ASAX file to

     <%@ Application Codebehind="Global.asax.cs" Inherits="Umbraco.Web.UmbracoApplication" Language="C#" %>

     

    Thank you,

    Amrut

Please Sign in or register to post replies

Write your reply to:

Draft