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!