Miniprofiler for ASP.NET web site

天涯浪子 提交于 2019-12-18 02:46:10

问题


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.

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

回答1:


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.



来源:https://stackoverflow.com/questions/15087101/miniprofiler-for-asp-net-web-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!