Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6089265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:04:48+00:00 2026-05-23T12:04:48+00:00

My ASP.NET MVC 3 web project was working fine, then I recompiled it and

  • 0

My ASP.NET MVC 3 web project was working fine, then I recompiled it and now I’m getting this error (some paths and namespaces changed to protect the innocent):

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:

Line 66:
RouteTable.Routes.MapRoute( Line 67:
“DefaultRoutes”, // Route name Line
68:
“{module}/{controller}/{action}/{id}”,
// URL with parameters

Source File: ….\Global.asax.cs
Line: 66

Stack Trace:

[NullReferenceException: Object
reference not set to an instance of an
object.]
Project.MvcApplication.RegisterRoutes(RouteCollection
routes) in D:…..\Global.asax.cs:66
Project.MvcApplication.Application_Start()
in D:…..\Global.asax.cs:139

[HttpException (0x80004005): Object
reference not set to an instance of an
object.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
context, HttpApplication app) +4051717
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
appContext, HttpContext context,
MethodInfo[] handlers) +191
System.Web.HttpApplication.InitSpecial(HttpApplicationState
state, MethodInfo[] handlers, IntPtr
appContext, HttpContext context) +352
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +407
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +375

[HttpException (0x80004005): Object
reference not set to an instance of an
object.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext
context) +11642112
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext
context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +4865877

I’m using IIS7.5 on Windows 7 x64, and the app pool is configured to run with .NET 4 and the ‘Integrated’ managed pipeline.

I’ve tried rebooting, and also cleaning out the bin and obj folders with no success.

Some extra information that turns out to be important – the line missing from the error page above:

RouteTable.Routes.MapRoute(
    "DefaultRoutes", // Route name
    "{module}/{controller}/{action}/{id}", // URL with parameters
    new { module = _loadedModules.FirstOrDefault().Name, controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:04:49+00:00Added an answer on May 23, 2026 at 12:04 pm

    This project dynamically loads modules and what wasn’t clear from the original ASP.NET error page was that the NullReferenceException was being caused by the final line of the MapRoute() method call.

    It turns out that _loadedModules was empty, so FirstOrDefault() was returning null – hence the exception.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im working on a web project in ASP .NET MVC 2. In this project
I've integrated ASP.NET MVC 3 project into existing Web Forms project. It was working
I'm adding some ASP.NET MVC pages to an existing ASP.NET Web Forms project. I've
I'm working with the System.Web.Helpers.WebGrid in an ASP.NET MVC 3 Razor project, and I'm
I'm currently working on an ASP.net MVC web site project. I've put all database
I have a working ASP.NET MVC web application to manage projects and customers. Now
I'm working on a Web project using Asp.Net MVC, which I'll have to deploy
Once an asp.net MVC project has a web deployment project associated with it, there
When I switch my ASP.NET MVC project from Cassini web server to IIS Express,
We have an ASP.Net MVC project that will start with a single web server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.