glimpse .net_如果您没有在ASP.NET中使用Glimpse进行调试和配置,则可能会错过

glimpse .net

glimpse .net

Glimpse NuGet packages

I've blogged about Glimpse since the day I first saw it at Mix 2011's open source fest. It's popular, but frankly, Glimpse is so useful more people need to know about it.

自从我在Mix 2011的开源音乐节上首次看到Glimpse以来,我就一直在写博客。 它很流行,但坦率地说,Glimpse非常有用,因此更多的人需要了解它。

From within your ASP.NET application in Visual Studio, install Glimpse using NuGet. You'll want to install the right Glimpse packages for the ASP.NET features you're using. For example, I'm using MVC4 and Entity Framework 5, so I will use NuGet and:

在Visual Studio的ASP.NET应用程序中,使用NuGet安装Glimpse。 您将要为使用的ASP.NET功能安装正确的Glimpse软件包。 例如,我正在使用MVC4和Entity Framework 5,因此将使用NuGet和:

install-package Glimpse.MVC4
install-package Glimpse.EF5

These packages pull in the core Glimpse libraries plus the hooks for the specific ASP.NET modules and handlers needed for Glimpse to collect all the information about your application and present it to the client side. Be sure to pick the right NuGet packages for your project type.

这些软件包引入了核心的Glimpse库,以及特定的ASP.NET模块的钩子,以及Glimpse收集有关应用程序的所有信息并将其提供给客户端所需的处理程序。 确保为您的项目类型选择正确的NuGet软件包。

The releases of Glimpse 1.4.0, and now most recently 1.5.0 improve Glimpse with the addition of a really amazing HUD (Heads Up Display). As you hover over each segment, it pops up with lots of details about the HTTP request, AJAX requests, deep inspection database interactions, and lots more.

Glimpse 1.4.0以及最新的1.5.0发行版增加了一个非常出色的HUD(平视显示器),从而改善了Glimpse。 当您将鼠标悬停在每个段上时,它会弹出有关HTTP请求,AJAX请求,深度检查数据库交互等的许多详细信息。

Glimpse's new HUD

Here I've hovered over one segment and you can see the time it took to render this first page, and exactly how much time was spent during each activity, from rendering to action methods to database connections.

在这里,我将鼠标悬停在一个段上,您可以看到呈现第一页所花费的时间,以及从渲染到操作方法再到数据库连接的每个活动的确切时间。

The Glimpse HUD expanded

You can move from the HUD to the standard Glimpse view. The best part is that each Glimpse Tab is a plugin itself! There's a whole community creating Glimpse Plugins. If you're using RavenDB, or NHibernate, or SignalR or whatever, you can get introspection into what's going on in a Glimpse Tab.

您可以从HUD移到标准的Glimpse视图。 最好的部分是每个Glimpse Tab本身都是一个插件! 整个社区都在创建Glimpse插件。 如果您使用的是RavenDB,NHibernate,SignalR或其他工具,则可以对Glimpse选项卡中的情况进行自省。

You turn Glimpse on and off with cookies, and you can setup security policy however you want. Glimpse isn't in the background creeping around - you have absolute control over when you want it used. Perhaps local and only when debugging, or perhaps always and with a specific cookie value, it's up to you.

您可以使用cookie打开和关闭Glimpse,也可以根据需要设置安全策略。 瞥见不是在后台蔓延-您完全可以控制何时使用它。 可能是本地的,仅在调试时,或者可能总是并且具有特定的cookie值,这取决于您。

Below you can see the actual SQL query executed by my Entity Framework code and how long it took to execute. I didn't have to change any part of my code or do anything more than just install Glimpse. Glimpse added the modules and handlers, and Glimpse policies can be installed to turn Glimpse on or off based on any option I can think of. I can even put Glimpse into production and only turn it on for certain requests, giving me a profiling tool I can peek at whenever I like.

在下面,您可以看到由我的实体框架代码执行的实际SQL查询以及执行所需的时间。 除了安装Glimpse之外,我无需更改代码的任何部分或进行任何其他操作。 Glimpse添加了模块和处理程序,并且可以安装Glimpse策略以根据我能想到的任何选项来打开或关闭Glimpse。 我什可以将Glimpse投入生产,仅在某些请求时打开它,这给了我一个我可以随时查看的配置文件工具。

EF SQL queries viewed within Glimpse

You likely use F12 developer tools in Chrome, IE and Firefox, and you've seen Timeline views before. But remember that Glimpse is JavaScript and HTML on the client - it's NOT a browser plugin - and it's a series of plugins on the server that give you a holistic view that's way more than just what's visible on the client.

您可能在Chrome,IE和Firefox中使用了F12开发人员工具,并且之前已经看到过时间轴视图。 但是请记住,Glimpse是客户端上JavaScript和HTML-它不是浏览器插件-它是服务器上的一系列插件,可为您提供整体视图,而不仅仅是在客户端上可见。

Glimpse's Timeline View shows you exactly what's happening on the server, how long it's taking, and how it all fits together.

Glimpse的“时间轴视图”向您确切显示了服务器上正在发生的事情,花费了多长时间以及它们如何组合在一起。

image

Sessions within Glimpse are all tracked and be optionally named. Since the server is collecting what's going on, you can pull out a popup browser window of Glimpse and connect to sessions from other browsers. Below I'm using an iPhone mobile emulator from ElectricPlum and inspecting requests from another browser window.

Glimpse中的所有会话均被跟踪,并可以选择命名。 由于服务器正在收集正在发生的事情,因此您可以拉出Glimpse的弹出浏览器窗口,并从其他浏览器连接到会话。 下面,我使用的是ElectricPlumiPhone移动模拟器,并检查来自另一个浏览器窗口的请求。

Using Glimpse to debug remotely against an iPhone Emulator

Glimpse is all open source and under the Apache 2.0 license. You can certainly help out, but the most interesting thing in my opinion is writing Glimpse Tabs - extending Glimpse to collect and show new data. Tabs can show technical stuff, but even business stuff that's specific to your application or style of application. For example, the Umbraco CMS could make a Glimpse Tab that puts configuration or technical Umbraco specific details up front. A line of business app could show tax details or shopping cart contents.

Glimpse是所有开源程序,并获得Apache 2.0许可。 您当然可以帮忙,但是我认为最有趣的事情是编写Glimpse标签-扩展Glimpse以收集和显示新数据。 标签可以显示技术资料,甚至可以显示特定于您的应用程序或应用程序样式的业务资料。 例如,Umbraco CMS可以制作一个Glimpse选项卡,该选项卡将配置或技术性Umbraco特定细节放在前面。 一系列业务应用程序可以显示税收详细信息或购物车内容

Glimpse is so useful that it's the first thing I install after I File | New Project on any non-trivial thing I'm working on. It's replaced Mini-Profiler as my go-to "production profiler" for web apps, and if you use ELMAH to collect and manage your application errors, there's even a Glimpse ELMAH plugin!

Glimpse非常有用,它是我在File | File之后安装的第一件事。 关于我正在从事的任何重要工作的“新项目”。 它已取代Mini-Profiler成为我的Web应用程序“生产分析器”,如果您使用ELMAH收集和管理应用程序错误,甚至还有Glimpse ELMAH插件

Check it out and go talk to Anthony and Nik about Glimpse on Twitter and thank for their work!

检查一下,然后在Twitter上与AnthonyNik讨论有关Glimpse的问题,并感谢他们的工作!

DISCLOSURE NOTE: The Red Gate company sponsors the Glimpse open source project. Red Gate also sponsored my blog feed this week. That is a cool coincidence, but it's just a coincidence. Red Gate does a lot of stuff. This post about Glimpse was written earlier. Just an FYI for y'all.

披露说明: Red Gate公司赞助了Glimpse开源项目。 Red Gate本周还赞助了我的博客供稿。 那是一个很酷的巧合,但这只是一个巧合。 红门做了很多事情。 这篇关于Glimpse的文章是较早撰写的。 仅供大家参考。

Sponsor: Big thanks to the folks at Red Gate for sponsoring the feed this week. Take a moment and check out their free download of Deployment Manager! Easy release management: Deploy your .NET apps, services and SQL Server databases in a single, repeatable process with Red Gate’s Deployment Manager. There’s a free Starter edition, so get started now!

赞助商:非常感谢Red Gate的人们本周赞助了feed。 花点时间检查一下他们免费下载的Deployment Manager! 轻松的发布管理使用Red Gate的Deployment Manager在一个可重复的过程中部署.NET应用程序,服务和SQL Server数据库。 有免费的简化版,请立即开始!

翻译自: https://www.hanselman.com/blog/if-youre-not-using-glimpse-with-aspnet-for-debugging-and-profiling-youre-missing-out

glimpse .net

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值