Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Miniprofiler for ASP.NET web site

enter image description hereHow can I use miniprofiler in asp.net web site(NOT FOR MVC)? There are many resources for MVC but I can not find anything for web site.

Thanks to Alex. Now it works for asp.net web site. But I can not understand what it displays. I have not written any code in method. See the image below.

Code is as below for which I ran profiler.

protected void Page_Load(object sender, EventArgs e)
{
    using (MiniProfiler.Current.Step("test"))
    {
        Page.Title = "12345";
    }
}
like image 970
Microsoft Developer Avatar asked Feb 26 '13 10:02

Microsoft Developer


People also ask

What is MiniProfiler C#?

MiniProfiler is a library and UI for profiling your application. By letting you see where your time is spent, which queries are run, and any other custom timings you want to add, MiniProfiler helps you debug issues and optimize performance.

What is MiniProfiler .NET core?

MiniProfiler is a very lightweight, easy to use profiling library for ASP.Net applications which can profile dotnet application during runtime without change to the environment and effect on the application.


1 Answers

From the miniprofiler.com:

PM> Install-Package MiniProfiler

in your global.asax:

using StackExchange.Profiling;
...    
protected void Application_BeginRequest()
{
    if (Request.IsLocal)
    {
        MiniProfiler.Start();
    } 
}

protected void Application_EndRequest()
{
    MiniProfiler.Stop();
}

and then somewhere in your master page:

<%= StackExchange.Profiling.MiniProfiler.RenderIncludes() %>

This should be enough for starting.

like image 189
Oleks Avatar answered Sep 30 '22 14:09

Oleks