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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:43:44+00:00 2026-06-11T21:43:44+00:00

I’m working on a Web app using ASP.NET. I have a class called Sistema

  • 0

I’m working on a Web app using ASP.NET. I have a class called “Sistema” that uses the Singleton pattern.

When the instance of Sistema is created, the database connection is opened and a process runs that loads some static information for later use. This lasts almost 2 minutes.

private static Sistema instance;
private Sistema()
{
    OpenDataBase();
    LoadStaticInformation();
}

public static Sistema GetInstance()
{
    if (instance == null)
    {
        instance = new Sistema();
    }
    return instance;
}

The reason why I keep the connection to the database open is because I’m using db4o, that strongly suggests this. Here are some references:

db4o best practice to query objects from db

Is it OK to open a DB4o file for query, insert, update multiple times?

Query regarding database connectivity in db4o

On my Web App I have a Master Page that controls if the user is logged in by checking a Session variable. If this Session is null, then the user is sent to the Login Page.

On the Login Page, the first thing I do is to check if the instance of “Sistema” is null. If it is, then when the user hits the Submit button, a message is shown saying “Login can take up to two minutes. Please wait”. If it is not null, then no message is shown as the login action takes only a couple of seconds.

I have been told by the users, that when going through the System, they are sometimes sent back to the login page, and when they try to login, the message saying “Login can take up to two minutes” is displayed and login indeed takes a while.

The fact that they are sent back to the login page means that the Session variable is lost, and the message being displayed means that the instance of “Sistema” is also null.

In order to determine why this is happening, I created a web page that sends an email to me when the instance of Sistema detected to be null. I thought that if I was able to know when this occurred, I might discover what is going on.

This web page is really simple. It runs every 10 minutes and checks if the instance of Sistema is null. If it is, then an email is sent and the instance of Sistema is created.

bool isInstanceNull = Sistema.IsInstanceNull();
if (isInstanceNull)
{
    String emailTo = "...";
    String emailContent = "...";
    Functions.SendMail(emailTo, "Sistema is null", emailContent, "");

    Sistema.GetInstance();
    Functions.SendMail(emailTo, "Sistema has been created", emailContent, "");
}

The only thing I discovered is that it’s not happening at a specific time. For example, last week it happened around 7pm, but today it happened at 2 am.

Regarding the Session timeout, I’m using a solution in the code behind: http://www.beansoftware.com/ASP.NET-Tutorials/Keep-Session-Alive.aspx.

Any suggestions to why is this happening?

  • 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-11T21:43:45+00:00Added an answer on June 11, 2026 at 9:43 pm

    The application pool has a property that causes it to be automatically recycled every N minutes (defaults to 1740, or every 29 hours.) Make this zero to disable recycling. The propertry is (on IIS7) under the “Recycling” heading and is called “Regular Time Interval (minutes)”

    enter image description here

    Apart from that, you should always close connections immediately and dont use static connections at all in ASP.NET (when Connection-Pooling is enabled which is default).

    I mention it because of:

    private static Sistema instance;
    private Sistema()
    {
        OpenDataBase();
        LoadStaticInformation();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.