I have an ASP.NET MVC application, which seems to run OK on my machine, but not when it runs on the server. Does anyone have any tips on finding out where the performance bottleneck may by or any general tips? Would routing misconfiguration ever slow down an application?
I have added HttpContext.Current.Trace.Write
statements throughout the code, but they don't show in the application trace log (/trace.axd
)? How can you write to this? I want to be able to see what parts might be slow when the application is being used, without having to have page trace enabled. When page trace is enabled, it writes out information for every partial view that may be used.
A third party library (MvcSiteMap) I am using might be the issue, but can't really be sure since it is not too bad performance wise on my local PC and I can't debug the code directly on the server. The application doesn't hang, it just takes several minutes for the page to load.
You need to understand where the website is spending its time. For us to help you, we're going to need some indication of where the problem is (database, partial views, etc.) and some code to look at.
Here are some resources for you:
http://www.slideshare.net/rudib/aspnet-mvc-performance (gets better later on in the presentation)
Grab a ten day free trial of this:
http://www.jetbrains.com/profiler/
Here are some links to get you going (remember that MVC is built on top of Asp.Net):
http://msdn.microsoft.com/en-us/library/ms178643(v=VS.100).aspx
http://www.codeproject.com/KB/aspnet/10ASPNetPerformance.aspx