Mini MVC profiler: appears to be displaying profile times for every static resource

后端 未结 2 492
死守一世寂寞
死守一世寂寞 2020-12-14 01:30

I\'ve just started using the mvc-mini-profiler (http://code.google.com/p/mvc-mini-profiler/) and I think it\'s awesome. However, I\'m getting some odd behaviour while using

相关标签:
2条回答
  • 2020-12-14 01:53

    Yes this is correct but it is very easy to filter these out.

    Taken from the sample code in the project Source

    void Application_Start(object sender, EventArgs e)
    {
        // Code that runs on application startup
    
        // some things should never be seen
        var ignored = MiniProfiler.Settings.IgnoredPaths.ToList();
    
        ignored.Add("WebResource.axd");
        ignored.Add("/Styles/");
    
        MiniProfiler.Settings.IgnoredPaths = ignored.ToArray();
    }
    

    This lets you filter out what you want to see or not this is a sample of what I have excluded in my web application which i am finding is working for my application

    ignored.Add("WebResource.axd");
    ignored.Add("ScriptResource.axd");
    ignored.Add("/Styles/");
    ignored.Add("/Images/");
    ignored.Add(".js");
    
    0 讨论(0)
  • 2020-12-14 01:57

    You can actually put that in one line and also omit the slashes. Like this:

        protected void Application_BeginRequest()
        {
            if (Request.IsLocal)
            {
                MiniProfiler.Start();
                MiniProfiler.Settings.IgnoredPaths = new[] { "static", "webresource.axd", "styles", "images" };
            }
         }
    
    0 讨论(0)
提交回复
热议问题