用于ASP.NET网站的Miniprofiler

时间:2013-02-26 10:47:14

标签: asp.net web mvc-mini-profiler

enter image description here如何在asp.net网站(NOT FOR MVC)中使用miniprofiler? MVC有很多资源,但我找不到网站的任何内容。

感谢Alex。现在它适用于asp.net网站。但我无法理解它显示的是什么。 我没有在方法中编写任何代码。见下图。

代码如下所示,我运行了探查器。

protected void Page_Load(object sender, EventArgs e)
{
    using (MiniProfiler.Current.Step("test"))
    {
        Page.Title = "12345";
    }
}

1 个答案:

答案 0 :(得分:26)

来自miniprofiler.com

  

PM> Install-Package MiniProfiler

global.asax

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

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

然后在您母版页的某个位置:

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

这应该足以让你开始。