Asp.net| Program
As you all know, it's not easy to implement a 24*7-24x7 application. One of my projects had been stuck in a violent load for more than 20 hours after a heroic fall. Luckily, ASP. NET and IIS provide us with some simple facilities that allow us to easily build super stable. NET application. However, it is a bit annoying that the configuration methods under Windows IIS6.0 and the Windows 2003 (IIS6.0) system are different.
First of all, the Windows 2000 system, familiar with the asp.net brother should know machine.config this file, it is kept in%windowpath%\microsoft.net\framework\%. The netversion%\config\ directory. Whatever text editor you use (and of course the most earthy is "notepad") open the file and find the section <processmodel ...>. Asp. NET is to control the ASP.net service process (aspnet_wp.exe or W3wp.ext) based on the settings in this section. Our written asp.net application code runs in this process space. If you are using the framework 1.1 you will see in this section N multiple attributes, we are concerned with the following three, followed by their default values:
timeout= "Infinite"
idletimeout= "Infinite"
memorylimit= "60"
You can't see them under the Framework 2.0, but you can add them by hand.
Let me translate the meaning of these three properties and restart the ASP after the timeout specified time is continuously run. NET service process, the default value of timeout is infinity, you can reset it in the format of "HH:MM:SS", for example, timeout=24:00:00 to reboot after 24 hours, or restart ASP if no one is accessing it within the time specified by IdleTimeout. NET service process, the default value of the idletimeout is also infinity, set as above, and restart the ASP if the ASP.net service process uses more memory than the total amount of memorylimit specified. NET service process.
Understand that, through the combination of these three attributes, you can not know, unnoticed, restart the service process, so that my application endless running. I say this, attentive readers may have found the problem, when the service process restart, the client's session is bound to be lost, the user's operation is interrupted. How can you do "God does not know, unnoticed"?
This problem does exist, but it can be minimized by the following measures, or even completely eliminated:
First, we can set idletimeout to a reasonable value, which I usually place as 1.5-3 times times the session timeout setting. Set the timeout to the upper limit that the program can hold, and I usually set it to 24 hours. This will force the service process to restart at idle time, because no session is present, so it is not possible to interrupt the user's actions. This setup is very effective in the small and medium business environment, because no one is accessible after work.
Of course, the methods above are very restrictive and can only work on specific occasions. If you restart with continuous access or memory overrun, the user's actions will still be disturbed. The ultimate solution is to save the session state in a separate process. On ASP.net, this can also be achieved through a simple configuration.
Source: BLOG Record a room