Why are the static variable data lost and are they not an instance when IIS / ap...
source link: https://www.codesd.com/item/why-are-the-static-variable-data-lost-and-are-they-not-an-instance-when-iis-application-pools-are-rebooted.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Why are the static variable data lost and are they not an instance when IIS / application pools are rebooted?
Why is that if I restart IIS, a static variable's data is lost (e.g. in a webpart property in Sharepoint) but in an instance variable, this is not the case?
This is with IIS7 and Windows Server 2008 R2 x64.
Thanks
If a process is restarted, all variables are lost. But: IIS automatically serializes the session variables into another processes memory when a pool is recyled. When the pool restarts, the session variables are deserialized and thus, restored. This is done with the .NET serialisation feature, which means that all session variables has to be marked with the [Serializable] attribute, otherwise you get runtime excpetions.
Related Articles
Why should the static variable be explicitly defined?
In php, how can I make sure that the static variables declared in a function will not be restarted each time the function is called?
Where are the static variables (data segment or heap or BSS) stored?
Why does the static variable not point to nil after being initialized?
Why does the menu appear in Chrome and FireFox, but not IE?
Initialization of the static variable for classes in C ++, why include the data type?
What is the difference between the static variable and the global variable (Java)?
Why the static initializer allows the reset of the static variable in Java?
Why the static variable is shared between threads
What is the reason for using the static variable and the instance variable?
What are the static variables when the libraries are statically linked
why the value of the static variable is the same as I changed it to method
Questions about the static keyword with functions and data
How does it java the static variables and the static method? (With a simple code)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK