zoukankan      html  css  js  c++  java
  • EF框架 监控小工具 MiniProfiler

    一、NuGet安装:

    MiniProfiler

    MiniProfiler.EF6

    如果在MVC中使用则再多安装

    MiniProfiler.MVC(X)       //X:mvc版本号

    二、web.config 中添加

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

    三、Global.asax.cs

    protected void Application_Start(object sender, EventArgs e)
            {
                // 在应用程序启动时运行的代码  ※必须要放置在数据库初始化前
                MiniProfilerEF6.Initialize();
                // 数据库初始化
                Database.SetInitializer<DataBaseCenter.DB.BIContext>(null);           
    
            }
        protected void Application_BeginRequest(object sender, EventArgs e)
            {
                if (Request.IsLocal) MiniProfiler.Start();
            }
        protected void Application_EndRequest()
            {
                if (Request.IsLocal) MiniProfiler.Stop();
            }

    页面呈现:在body中添加

    <%= Request.IsLocal ? StackExchange.Profiling.MiniProfiler.RenderIncludes().ToString() :"" %>

    呈现结果:

    这样就可以实地检测喽。

  • 相关阅读:
    HDU3516 树的构造
    poj1160 post office
    poj1260 pearls
    POJ 3709 K-Anonymous Sequence
    HDU2829
    HDU 3480 division
    HDU3507 print artical
    HDU2490 parade
    HDU3530 子序列
    HDU3415
  • 原文地址:https://www.cnblogs.com/OleRookie/p/5959539.html
Copyright © 2011-2022 走看看