MiniProfiler not showing up on asp.net MVC

前端 未结 3 1339
一向
一向 2020-12-14 07:32

I added this to my Global.asax.cs:

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

protecte         


        
相关标签:
3条回答
  • 2020-12-14 08:08

    If anybody tried Alden's solution and still does not work for you, try setting discardResults to false as suggested by willgrosett

       // Global.asax.cs file
       protected void Application_BeginRequest()
        {
            if (Request.IsLocal)
            {
                MiniProfiler.Start();
            }
        }
    
        protected void Application_EndRequest(object sender, EventArgs e)
        {
            MiniProfiler.Stop(discardResults: false);
        }
    
    0 讨论(0)
  • 2020-12-14 08:12

    In your web.config, add this:

    <system.webServer>
        ...
        <handlers>
            <add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
            ...
        </handlers>
        ...
    

    If you want some sweet MVC Action profiling (unrelated to your problem), add this line to Application_Start in Global.asax.cs:

    GlobalFilters.Filters.Add(new StackExchange.Profiling.MVCHelpers.ProfilingActionFilter());
    
    0 讨论(0)
  • 2020-12-14 08:25

    In MiniProfiler latest version:4.0.165. Be sure you added the code in Application_Start()

    protected void Application_Start()
    {
        ...
        MiniProfiler.Configure(new MiniProfilerOptions());//default setting
        MiniProfilerEF6.Initialize();
    }
    

    Doc is here: https://miniprofiler.com/dotnet/AspDotNet

    And in latest version, you don't need add

    <system.webServer>
        ...
        <handlers>
            <add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
            ...
        </handlers>
        ...
    

    in Web.config anymore.

    0 讨论(0)
提交回复
热议问题