博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用MiniProfiler调试ASP.NET web api项目性能
阅读量:6905 次
发布时间:2019-06-27

本文共 760 字,大约阅读时间需要 2 分钟。

本质上,集成Miniprofiler可以分解为三个问题:

  1. 怎样监测一个WebApi项目的性能。
  2. 将性能分析监测信息从后端发送到UI。
  3. 在UI显示分析监测结果。

首先安装Miniprofiler,MiniProfiler.EF6

在Global.asax  加入

1 protected override void Application_Start(object sender, EventArgs e) 2 { 3 StackExchange.Profiling.EntityFramework6.MiniProfilerEF6.Initialize(); 4 MiniProfiler.Settings.Results_Authorize = p => true; 5 MiniProfiler.Settings.Results_List_Authorize = p => true; 6 MiniProfiler.Settings.RouteBasePath = "~/profiler/";//访问路径/profiler/results 或者/profiler/results-index 7  8 base.Application_Start(sender, e); 9 }10 11 12 protected void Application_BeginRequest()13 {14 15 MiniProfiler.Start();16 17 }18 19 protected void Application_EndRequest()20 {21 MiniProfiler.Stop();22 }

 

运行项目,http://localhost//profiler/results-index  即可看到监测结果

转载地址:http://tpldl.baihongyu.com/

你可能感兴趣的文章
day40-python多进程多线程-多线程实例和锁
查看>>
关于使用pip安装软件的存储库的问题-python
查看>>
Android Material Design-Getting Started(入门)-(一)
查看>>
CHIL-ORACLE-truncate 语法 清空表数据
查看>>
IE和FireFox下的JS调试工具
查看>>
2018全球最强物联网公司榜单揭晓
查看>>
docker的安装和docket拉取Oracle
查看>>
innobackupex 备份数据搭建 MySQL Slave
查看>>
Linux学习三部曲(之二)
查看>>
C#winform拖动无边框窗体
查看>>
CentOS 6.5安装KVM虚拟化
查看>>
centos6构建XFS文件系统
查看>>
服务器硬件监控之Check_openmanage
查看>>
获取免费Windows Store开发者账户方法
查看>>
程序员杂记系列
查看>>
参加“北向峰会”后对SOC之感言
查看>>
ASP.NET vNext MVC 6 电商网站开发实战
查看>>
马化腾IT领袖峰会力推,微信小程序即将迎来爆发拐点
查看>>
javascript js 判断页面是否加载完成
查看>>
Ural_1494. Monobilliards(栈)
查看>>