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

  • Home
  • SEARCH
  • 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 6180007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:46:16+00:00 2026-05-24T00:46:16+00:00

My Application_Start code on the global.asax takes 2-3 minutes to finish (long db queries,

  • 0

My Application_Start code on the global.asax takes 2-3 minutes to finish (long db queries, etc)

Whenever I publish a new version of the site, I get deadlocks on aspnet_isapi.dll and the application doesn’t start.

The only way for it to start is when I disable the IIS from being accessed from the internet, restart the application again & make one call to the site (in order for the global.asax) to work.

I don’t understand why the deadlock happens when I get lots of page/files requests when application starts. I know that Application_Start on global.asax fires just once so, and I guess that all other clients just wait until the event completes, so I don’t see a reason for it to have a deadlock.

Any thoughts?

Update:

It takes more like 4-5 minutes…
The code is makes db queries and attach them to the Application variable (for later use).
it’s a virtual server on a dedicated server of mine. only one other machine is on that does not take much resources.
I get Event ID 2262 – ISAPI ‘…\aspnet_isapi.dll’ reported itself as unhealthy for the following reason: ‘Deadlock detected’.

There is one SQL query that takes most of the time. I can execute this query on a different process (windows service / etc) but the problem is that I don’t understand why it happens….
What will happen if in the future I’ll have to put some time consuming code inside the Application_Start?

  • 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-24T00:46:17+00:00Added an answer on May 24, 2026 at 12:46 am

    There’s several problems with this approach.

    First – to load that much data and stick it in the application seems excessive. I can query millions of records in that much time so I would check your indexes and queries to make sure this really is necessary. What sort of data are you loading that has to go into application?
    Remember also you will be increasing the working memory of the application which at some point could cause it to be reset based on the IIS worker process settings.

    Application_Start should finish as quick as possible so the runtime knows everything loaded ok. I believe your deadlock isn’t a deadlock as in a typical scenario but as in a ‘I think its stuck’ scenario.

    As mentioned – one option is to pull your processing out into another thread. However note that when your application goes idle for a while it will be shut down. You can change these settings in IIS though, but I would really consider rethinking this loading of data. Why not query on demand from the database? You could create a new indexed view with this data on the database side (amongst other suggestions)

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

Sidebar

Related Questions

Does the Application_Start in global.asax called when the new published code is kept in
This is my VB code for global.asax <%@ Application Language=VB> <script runat=server> Sub Application_Start(ByVal
I have code in my global.axax: protected void Application_Start() { WindsorContainer = new WindsorContainer();
In Application_Start event in global.asax.cs, I have added some initialization code. This code is
Is there a way to handle the application_start event without using the global.asax? The
How to call or make the javascript function from the Application_Start of global.asax in
It's most common practice to register routes in Application_Start event within global.asax.cs/vb file. But
I have the Global.asax like the code below: public class MvcApplication : System.Web.HttpApplication {
I've put the following code in global.asax <%@ Application Language=VB %> <script runat=server> Sub
Right now, in development I have the following code in the Global.asax.cs file that

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.