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() :"" %>

    呈现结果:

    这样就可以实地检测喽。

  • 相关阅读:
    poj3723Conscription
    hiho1304 24点
    hdu2089不要62
    hdu3555Bomb
    关于分割平面问题
    poj2976Dropping tests(01分数规划)
    linux命令行
    java内存不足
    如何设置jsp默认的编码为utf-8
    visul svn+花生壳
  • 原文地址:https://www.cnblogs.com/OleRookie/p/5959539.html
Copyright © 2011-2022 走看看