I was faced recently with slow application startup for any ASP.NET based application on a brand spanking new Windows 2012 VM.
Some quick analysis showed that static content was served up fast, even on the first hit. However anything going through the managed pipeline would take up to 23 seconds for the first hit. That’s quite a lot for a simple index.html file that would serve in 10 to 30ms when treated as static content.
Initial investigation made it unlikely that the hardware and/or VM was the problem. So the next likely candidate is the ASP.NET pipeline initialization.
Clearing out all but some essential handlers dramatically reduced the time-to-first data for the initial request. But, a bunch of these handlers are there for good reason. For example to protect sensitive files.
Pingfu to the rescue
For production use, Pingfu did the hard work already and came up with a list of handlers that can safely be removed for ASP.NET 4.x sites in integrated mode. Originally, this list is intended to reduce the attack surface of an ASP.NET application but it has the happy side effect of reducing application startup times by 10 to 12 seconds.