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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:25:31+00:00 2026-05-23T17:25:31+00:00

I have a static class in my ASP.NET app that I use to hold

  • 0

I have a static class in my ASP.NET app that I use to hold an application wide data processing class used to manage long running batch operations sent in by users. This should be a singleton object as it is quite a heavy object.

public static class WebGISGlobals
{
    private static MultiStatutoryMapPrintProcessor _batchPrintProcessor;

    public static MultiStatutoryMapPrintProcessor BatchPrintProcessor
    {
        get
        {
            if (_batchPrintProcessor == null)
            {
                _batchPrintProcessor = new MultiStatutoryMapPrintProcessor(
                    (string)ConfigurationManager.AppSettings["statPrintWebServiceUrl"], HttpContext.Current.Server.MapPath("~/downloads"));
            }

            return _batchPrintProcessor;
        }
    }

}

This processor class passes the batch tasks to the Threadpool for execution and all works well….

except, when the queue becomes empty and the processes stop the next time the singleton is requested using WebGISGlobals.BatchPrintProcessor to collect the task results the object is null and creates a new instance. This unfortunately loses me reference to the output files it produces.

I have tried using Application["BatchProcessor"] to store my class instance for all to reference but it has the same effect.

Nowhere in my code do I dispose the instance or set it as null so I am stuck.

Anyone have any bright ideas.

UPDATE:

After a suggestion from rsbarro I have run a stack trace on the thread execution and it does not show any exceptions being fired.

>   WebFGH.DLL!FGH.Global.Application_End(object sender = {System.Web.HttpApplicationFactory}, System.EventArgs e = {System.EventArgs}) Line 167    C#
[Native to Managed Transition]  
[Managed to Native Transition]  
System.Web.dll!System.Web.HttpApplication.ProcessSpecialRequest(System.Web.HttpContext context = null, System.Reflection.MethodInfo method, int paramCount, object eventSource, System.EventArgs eventArgs, System.Web.SessionState.HttpSessionState session) + 0x110 bytes 
System.Web.dll!System.Web.HttpApplicationFactory.FireApplicationOnEnd() + 0x56 bytes    
System.Web.dll!System.Web.HttpApplicationFactory.Dispose() + 0x109 bytes    
System.Web.dll!System.Web.HttpRuntime.Dispose() + 0x114 bytes   
System.Web.dll!System.Web.HttpRuntime.ReleaseResourcesAndUnloadAppDomain(object state) + 0x35 bytes 
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(object state) + 0x2f bytes   
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes    
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(System.Threading._ThreadPoolWaitCallback tpWaitCallBack) + 0x53 bytes 
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(object state) + 0x59 bytes    
[Appdomain Transition]  
  • 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-23T17:25:33+00:00Added an answer on May 23, 2026 at 5:25 pm

    If nothing in your code is nulling out _batchPrintProcessor then a possible cause for the behavior you are seeing is that your ASP.NET application is being shut down (or restarted) by IIS. By default, Application Pools in IIS 7.5 are shut down every 20 minutes if there is no activity. You application will also be restarted by ASP.NET/IIS for a number of reasons, including changes to the bin directory, unhandled exceptions on spawned threads, etc.

    To check if this is the issue, just add some logging code to the Application_Start and Application_End events in your Global.asax.

    See also:
    What causes an application pool in IIS to recycle?

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

Sidebar

Related Questions

I have a static class that I use as my Data Utils for my
I have an ASP.NET MVC app which has a bootstrapper class that configures log4net
Right now I have a static class called universe in my ASP.NET application. The
In my asp.net application, I have the below static class to handle query strings
I have a ASP.NET MVC project that has a static class in it to
I have an ASP.NET application that relies on the Random class to generate a
So I have a static class that is supposed to be used as a
So I have an asp.net Web Application (Not Web Site) that I am trying
I often find when I'm writing a service class (within an ASP.NET app) that
I have an ASP.NET MVC (using the release candidate) application that works with a

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.