A memory overflow error occurs on the website developed with C #: "The System. OutOfMemoryException type is thrown"
Because many pages are difficult to identify the source of the problem at the beginning, the code that caused memory overflow was found for a long time. Summarize this method.
Symptom: A memory overflow error occurs at a time, and a large number of page requests are blocked on the server. After the iis program pool is recycled, it will be normal for a short time, but after a period of time, memory overflow occurs again. The time interval is different and there is no regularity.
Solution: 1. Identify the memory overflow error caused by a page request.
2. Search for problematic pages
Pages with memory overflow error codes should not be executed when requested.
Therefore, the OnPreInit method records the address and request time of the page to the database when all pages are requested. Each request adds a record to the database.
When the OnUnload method is executed on the page, update the total execution time of the page to the request record mentioned above. (When added, the total execution time is-1 by default)
Through the above method, analyze the pages that are not executed when memory overflow occurs several times. The final problem page is located. After the code is modified and uploaded, the memory overflow problem is solved.