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 7813051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:43:16+00:00 2026-06-02T04:43:16+00:00

Is MvcApplication singleton in a MVC 3 Web Application? Why did I find 3

  • 0

Is MvcApplication singleton in a MVC 3 Web Application? Why did I find 3 instances?

My steps: (VS2010 SP1 + ASP.NET MVC 3 Tools Update)

  1. create a default Internet MVC 3 Appliction (with the account sample)
  2. Add a MvcApplication() constructor in global.asax, and set a breakpoint in it
  3. Press F5 to debug

I found the constructor was called 3 times!

Best regards,

Zach@Shine

===Edit===

Correction:

2 instances, not 3 were found for 1 web app.
After a careful check, I found my solution contains 2 web apps, after I removed one of them, I can find 2 instances for the left app.

Here is the log (the numbers are the MvcApplication instances’ hashcode)

MvcApplication(): 41516761
Application_Start(): 41516761
 MvcApplication(): 56552081
 Application_AuthenticateRequest(): 56552081
 Application_AuthenticateRequest(): 56552081
 Application_AuthenticateRequest(): 56552081
 MvcApplication_Disposed(): 56552081
Application_End(): 41516761

As shown, one instance is used to handle Start, End events, and the other one is used to handle requests.

  • 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-06-02T04:43:17+00:00Added an answer on June 2, 2026 at 4:43 am

    MvcApplication inherits from HttpApplication from the normal asp.net below is a great link to understanding the asp.net pipeline. I have copied the relevant section from the article.

    In short – no MvcApplication is not singleton but there is only ever one present with each request.

    http://www.west-wind.com/presentations/howaspnetworks/howaspnetworks.asp

    Each request is routed to an HttpApplication object. The
    HttpApplicationFactory class creates a pool of HttpApplication objects
    for your ASP.NET application depending on the load on the application
    and hands out references for each incoming request. The size of the
    pool is limited to the setting of the MaxWorkerThreads setting in
    machine.config’s ProcessModel Key, which by default is 20.   The pool
    starts out with a smaller number though; usually one and it then grows
    as multiple simulataneous requests need to be processed. The Pool is
    monitored so under load it may grow to its max number of instances,
    which is later scaled back to a smaller number as the load drops.  
    HttpApplication is the outer container for your specific Web
    application and it maps to the class that is defined in Global.asax.
    It’s the first entry point into the HTTP Runtime that you actually see
    on a regular basis in your applications. If you look in Global.asax
    (or the code behind class) you’ll find that this class derives
    directly from HttpApplication:

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

Sidebar

Related Questions

in my asp.net-mvc application I have a statis MvcApplication that calls a static CreateContainer()
I have created a sample project using ASP.NET MVC 3 Web Application (Razor) template.
In my ASP.NET MVC application I want a user to add a value into
In my ASP.net MVC application i need to get the host of the application
In my ASP .NET MVC application i have a link that refreshes the preview
In my ASP.NET MVC application i am using Chinese Category Name, it was displayed
In my ASP.NET MVC application the ASP.NET pipeline is being invoked for static files
I am experiencing memory leaks in an ASP.Net MVC 3 application and I suspect
The moment I added a unit test to my ASP.NET MVC application to test
I am using AJAX-enable web services in my ASP.NET MVC3 application and I want

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.