• MiniProfiler 的使用


    EF4.5.1+MVC4

    1、依次:Install-Package MiniProfiler,Install-Package MiniProfiler.EF5,Install-Package MiniProfiler.Mvc4

    2.1、在_layout.cshtml 中加入

    @using StackExchange.Profiling
    <!DOCTYPE html>

    ..........

    @MiniProfiler.RenderIncludes()
    </body>

    2.2、2.1中@using StackExchange.Profiling会在页面生成形如 <script async type="text/javascript" id="mini-profiler"......</script>的脚本,为了处理脚本,在web.config中加入:

    <handlers>

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

    </handlers>

    不加这个,页面没有miniprofiler的显示。

    3.1、在Global.asax中加入:

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

    protected void Application_EndRequest()
    {
      MiniProfiler.Stop();
    }

    3.2 如果要看SQL的分析,要加入:

    protected void Application_Start()
    {
      MiniProfilerEF.InitializeEF42();

  • 相关阅读:
    Mysql密码操作
    最长公共子串(2017蓝桥杯省赛)
    一和零(leetcode)
    leetcode 235周赛
    袋子里最少数目的球(leetcode)
    第七周课后作业
    第四周jsp作业
    3.10
    3.4课堂练习
    DS博客作业05-查找批改
  • 原文地址:https://www.cnblogs.com/tider1999/p/4092892.html
Copyright © 2020-2023  润新知