参考自:http://www.cnblogs.com/chenwolong/p/MiniProfile.html

直接从Nuget上下载
MiniProfiler

MiniProfiler.EFX   这个X根据EF版本而定

然后在视图页加上

@using StackExchange.Profiling;
@MiniProfiler.RenderIncludes()

然后在Global.asax中添加三处红框

然后在Web.config中的<system.webServer>节点下添加下列配置

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

 

大功告成,亲测有效
效果图如下: