zoukankan      html  css  js  c++  java
  • Miniprofiler在普通net项目中的使用

    1、Global.asax中配置

    Void Application_BeginRequest(Object sender, EventArgs e){
      If(Request.IsLocal){ //请求来自本地计算机
       StatckExchange.Profiling.MiniProfiler.Start(); 
      }
    }
    
    Void Application_EndRequest(Object sender, EventArgs e){
      StackExchange.Profiling.MiniProfiler.Stop();
    }
    

    2、 在页面的最底部可以输出用于在页面呈现结果的html标签

    StackExchange.Profiling.MiniProfiler.RenderIncludes().ToHtmlString();

    3、监控sql语句的运行时间

    Var conn = new SqlConnection(“”);
    If(MiniProfiler.Current == null) return conn;
    Return new StackExchange.Profiling.Data.ProfiledDbConnection(conn, MiniProfiler.Current);
    

    问题:返回的是dbconnection类型,无法强制转换为sqlconnection

    4、Web.config文件中插入配置

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

      5、Miniprofiler配置

    MiniProfiler.Settings.PopupRenderPosition = RenderPosition.Right; // 提示条靠右显示
    MiniProfiler.Settings.ShowControls = true; // 提示条上显示“m”和“c”
    MiniProfiler.Settings.IgnoredPaths = new string[] { ".png", "/img/", "/js/" };// url请求中如果包含其中的内容,将不被监控
    

     

    问题1Iis6中,加入miniprofilerjs文件显示404错误

     

    问题2:左下角的mc不显示

    iis7,应用连接池 > 高级设置 > 启用32位应用程序 > false

    问题3:如何快速隐藏miniprofiler的左上角提示

    Alt + p

    参考资料

    官网的使用说明: http://miniprofiler.com/

  • 相关阅读:
    poj 2528 Mayor's posters (线段树+离散化)
    poj 1201 Intervals (差分约束)
    hdu 4109 Instrction Arrangement (差分约束)
    poj 1195 Mobile phones (二维 树状数组)
    poj 2983 Is the Information Reliable? (差分约束)
    树状数组 讲解
    poj 2828 Buy Tickets (线段树)
    hdu 1166 敌兵布阵 (树状数组)
    Ubuntu网络配置
    Button控制窗体变量(开关控制灯的状态)
  • 原文地址:https://www.cnblogs.com/smallidea/p/5274803.html
Copyright © 2011-2022 走看看