Original article address: NuGet Package of the Week #5-Debugging ASP. net mvc applications with GlimpseGlimpse is similar to the client debugger FireBug, which is implemented using JavaScript, but is also connected to the ASP. NET Server. Glimpse not only includes a better routing debugger, but also provides better support for Trace. Write (), which is very useful. Like in the actual series, you can start with me now and finish it within five minutes. Use NuGet to install Glimpse support for a new ASP. net mvc program or WinForm program. Before running the program, add Trace. Write and Trace. TraceError to the program.
1 public ActionResult Index()
2 {
3 ViewBag.Message = "Welcome to ASP.NET MVC!";
4 Trace.Write("Hey, this is nice");
5 Trace.TraceWarning("Oh, this could be bad.");
6 return View();
7 }
8
9 public ActionResult About()
10 {
11 Trace.TraceError("Oh, no! Thats bad");
12 return View();
13 }
Now, run the program to open Glimpse through bookmarks. However, I like to access http: // localhost: portname/Glimpse/Config, and then click the Turn Glimpse On button to enable it, one day, I will add it to my bookmarks. Then, when visiting the site, we noticed that the control panel of Glimpse appeared at the bottom of the page. It was not a browser plug-in and was implemented in JavaScript. On the Trace tab, can Trace output be better than Trace. axd? If you switch to the Router tab, you can also see the route used by the current request. Glimpse, I will add it to my favorites to use it every day, and I suggest you do the same. I only know some of the usage on the surface. You can go to the Glimpse site for in-depth exploration: www.getglimpse.com