This article is mainly for you to introduce in detail the ASP. MVC5 using Miniprofiler to monitor MVC performance, with a certain reference value, interested in small partners can refer to
Miniprofiler, a simple and effective mini-profiler, can effectively monitor the page in real time. Monitor the contents of the database by direct reference, Ajax, and other pages accessed in the form of an IFRAME, and can display SQL for database access.
1. Installation
Create an ASP. NET MVC Project First
Right-click the project and manage the NuGet package. Installing Miniprofiler.mvc4 and Miniprofiler
Ps:MiniProfiler.MVC4 's NuGet package (the MVC4 package supports MVC5)
Alternatively, you can open the Package Management Console input command to install
Install-package miniprofiler-version 3.2.0.157
Install-package miniprofiler.mvc4-version 3.0.11
2. Add the following to Application_Start () Global.asax
protected void Application_Start () {... GLOBALFILTERS.FILTERS.ADD (New Profilingactionfilter ()); var copy = ViewEngines.Engines.ToList (); ViewEngines.Engines.Clear (); foreach (var item in copy) { ViewEngines.Engines.Add (new Profilingviewengine (item));}}
3. Add the following to "Application_BeginRequest ()" and "Application_EndRequest ()", also in Global.asax
protected void Application_BeginRequest () {if (request.islocal) { miniprofiler.start ();}} protected void Application_EndRequest () {miniprofiler.stop ();}
4. Add the following to the _layout.cshtml (just before the </body> tag):
@StackExchange. Profiling.MiniProfiler.RenderIncludes () </body>
5. Add the following to the :
<system.webServer>
If you use the entity Framework in your project, you can install the MINIPROFILER.EF6 package and add the following at Application_Start () at the end of the Global.asax: Miniprofileref6.initialize ();
A simple way to monitor MVC performance is that, in fact, he has many features, such as the ability to detect and highlight areas that perform the same query with different parameters. This allows you to quickly find queries that may be in bulk.
You can also record all of the AJAX calls, view analysis information for the last 100 analysis requests, and more.
Results show: