I’ve notice that on the production server, my asp.net 4.7.2 application is very slow. By debugging I’ve found that in global.asax the Application_start and Application_end is called on every request, causing a recompile of the application each time and slowing down the response.
I0ve test it on several servers and the behaviour is always the same.
Running the website on localhost in IIS (not iis express) this not happen.
How can I check why Application_End is called and from where?
Debugging in VS the Application_end stacktrace is empty, I cannot see from where is called.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
The problem was cause by Kaspersky Endpoint Security for Windows Server version 22.214.171.1240.
For some unknown reason it act on w3wp.exe causing the application restart on each requests. The only way to solve the problem is excluding w3wp.exe from the monitored applications/processes.
There are many circumstances when the Application_end will be called, such as application pool’s recycle, web.config file’s change, or bin file’s change. For more detailed information about Application_end be called you need to check the Event log in the sever.