Solved

ASP.NET stores data on some static instances - do not persistence

Posted on 2014-03-03
2
408 Views
Last Modified: 2014-03-18
In asp.net I store data on static list so web users can access quickly without having to queries on sql.

From time to time the static list just disappear, when that happen asp.net with queries from sql again.

I which to know what cause the static object to disappear? is it because application pool recycling?

Thx,
0
Comment
Question by:JSW21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 300 total points
ID: 39902714
Yes, your static object exist as long as IIS process that is servicing your web requests is available.
You are better off using Cache in your page, for example:
http://asp.net-tutorials.com/caching/object-caching/
http://msdn.microsoft.com/en-us/library/aa478965.aspx
http://www.dotnetperls.com/cache
0
 
LVL 27

Assisted Solution

by:Sammy
Sammy earned 200 total points
ID: 39905271
Caching will NOT solve this problem. When the application pool recycles all APP Domain data gets wiped out, this includes, sessions, static objects and cache.
What you need to do is build your list in the Application_Start event. This is the only way to have the list recreated after the application pool recycle.

You can find it or create it in the event in your application's global.asxc.cs
 protected void Application_Start(object sender, EventArgs e)
{
//create your list here
}
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question