Search code examples
c#asp.net-mvcmvc-mini-profiler

MVC 'Find' method taking a long time (even in release)? (Using miniprofile)


I'm using MiniProfile to try and figure out why my MVC site is taking a long time. It looks like the 'Find' method is where the time is being spent. I have read a couple things on this and most people seemed to suggest that it was due to having <compilation debug="true" .. > set in the web.conf. I can confirm that in the following example the debug is not set (my compilation looks like the following):

<compilation targetFramework="4.0">
   ...
</compilation>

No where is debug mentioned. But yet, my find calls are taking upwards of three seconds :S

MiniProfiler

Any suggestions on how I can figure this out? (Note: I am running on an Azure production server. I have RDC'd into the system to confirm that the pushed web.config does not contain the debug="true").


Solution

  • If this is the first request coming to your website after publishing or after the AppDomain has been brought down by IIS it is normal that the Find method takes a long time. It will then cache the location for this view and on subsequent requests it should be much faster. Try Ctrl+F5ing in your browser on the same url.

    Also try explicitly setting debug="false" in your web.config.