Alex Rivera | Logout

Can I use the mvc mini profiler in a console application?

Asked 2011-09-11T11:15:22.180
22

How can I use the mvc-mini-profiler in a C# console application?

Also curious, does the mvc mini profiler put the actual profiled statistics in the left side of each web page or is that just custom javascript code done manually?

I downloaded and ran the mvc sample, and can't find that code that puts the results in that javascript popup.

Edit
Report

1 Answer

11

The core timing object (MiniProfiler) should work OK, as should the profiled-connection hooks etc; however you would need to;

  • add your own UI to show the results
  • define your own scope / lifetime (for web it is easy - just the http-request)
  • provide your own storage hooks (there is an extension API for this, that uses http-context by default IIRC)
  • either pass the profiler around manually, or define a sensible way to look up the current profiler instance

I know some people have used portions of it for WPF etc, so it can be used - but IMO it might make sense to pick just the bits that make sense, and use those to write a custom library that adds some awesome.

answered 2011-09-11T11:31:38.157

Your Answer