The Cache loss problem in Asp.net 2.0: "The value cannot be blank" or "the object reference is not set to the instance of the object"

Source: Internet
Author: User

I am writing the asp.net 2.0 program in C #, which involves the Single Sign-On problem. I will judge whether the user is online.

In the Cache declared in global. asax, the problem also arises: on my machine (XP-SP2, VS2005, PD

Dual-core 3.0g cpu, 1G memory) run no problem, in a colleague notebook (XP-SP2, VS2005, 1.7G, 512 M

Memory) Sometimes Cache loss occurs during runtime, as shown in "the Cache value cannot be blank" or

"NullReferenceException: object reference is not set to the instance of the object", and the server configured in a workgroup

(Windows 2003 Server.net framework 2.0, IIS 6.0, and 320M memory)

Elephant!

At first, I thought there were no rules for the loss Phenomenon. I checked the program settings repeatedly and did not find any exceptions. After reading the information and discussion, I sent

The loss is regular, and some people may have realized that, right, it is related to the configuration of the machine, strictly speaking, it is related to the memory.

Size Related !!!

Why? It turns out that the Cache will be removed when the memory is tight. During each fetch, you should determine whether the Cache is null or not.

You must obtain the data again, or add a Cache callback function to load the data in real time to make the data valid again.

The solution is simple: Increase the memory, or do not use the Cache. In my solution, all questions are asked after I use the Application.

Solve the problem!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.