Miniprofiler ASP。网的网站

时间:2021-10-30 03:17:33

Miniprofiler ASP。网的网站How 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.

如何在asp.net web站点中使用miniprofiler(而不是MVC)?MVC有很多资源,但是我找不到任何web站点的资源。

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.

感谢亚历克斯。现在它适用于asp.net web站点。但我不明白它显示的是什么。我没有在方法中编写任何代码。见下面的图片。

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";
    }
}

1 个解决方案

#1


25  

From the miniprofiler.com:

从miniprofiler.com:

PM> Install-Package MiniProfiler

点>安装包MiniProfiler

in your global.asax:

在你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.

这应该足够开始了。

#1


25  

From the miniprofiler.com:

从miniprofiler.com:

PM> Install-Package MiniProfiler

点>安装包MiniProfiler

in your global.asax:

在你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.

这应该足够开始了。