用于 ASP.NET 网站的 Miniprofiler [英] Miniprofiler for ASP.NET web site

查看:26
本文介绍了用于 ASP.NET 网站的 Miniprofiler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 asp.net 网站中使用 miniprofiler(不适用于 MVC)?MVC 有很多资源,但我在网站上找不到任何内容.

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 网站.但我无法理解它显示的内容.我没有在方法中编写任何代码.见下图.

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

推荐答案

来自 miniprofiler.com:

PM> 安装包 MiniProfiler

PM> Install-Package MiniProfiler

在您的 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() %>

这应该足够开始了.

这篇关于用于 ASP.NET 网站的 Miniprofiler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆