I have an ASP.NET 3.5 application with SQL 2005 at back end. In some instances, the code takes a long time to execute (30 sec or more), esp in reports.
- I would like to know where the code takes most of the time. Is there an easy way to do it?
I am using Visual Studio 2008. Right now I am troubleshooting a certain timeout scenario. Note: I do not have SQL Profiler (I am running Express version).
Have you tried Tracing?
A few
Trace.Write("...")statements might help you see where things are taking the longest to get an idea of where to dig further. Be sure to turn on tracing in the web.config, and on specific pages if you need them only on certain ones.Example of some usage:
The output will then show you the full page trace (with extra page things as well), and the time between the last trace of each line item, so you may see a 20 second gap between “Before Data Load” and “After Data Load”. That would give you an idea of where to look to improve things.