diff --git a/aspnet/mvc/overview/getting-started/mvc-learning-sequence.md b/aspnet/mvc/overview/getting-started/mvc-learning-sequence.md index 6a0cb70505..dc69c83392 100644 --- a/aspnet/mvc/overview/getting-started/mvc-learning-sequence.md +++ b/aspnet/mvc/overview/getting-started/mvc-learning-sequence.md @@ -42,11 +42,6 @@ by [Rick Anderson](https://twitter.com/RickAndMSFT) - [Create an ASP.NET web app in Azure](https://azure.microsoft.com/documentation/articles/web-sites-dotnet-get-started/) Short and simple tutorial for deployment to Azure. - [Create an ASP.NET MVC app with auth and SQL DB and deploy to Azure](https://azure.microsoft.com/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/) - -## Performance and Debugging - -- [Profile and debug your ASP.NET MVC app with Glimpse](../performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse.md) - ## ASP.NET MVC DropDownListFor with SelectListItem When using the helper and passing to it the collection of `SelectListItem` from which it is populated, the `DropdownListFor` modifies the passed collection after it is called. `DropdownListFor` changes the `SelectListItems` Selected properties to whatever was selected by the dropdown list. This leads to unexpected behavior. diff --git a/aspnet/mvc/overview/getting-started/recommended-resources-for-mvc.md b/aspnet/mvc/overview/getting-started/recommended-resources-for-mvc.md index 355baacc8d..19e05a3a4b 100644 --- a/aspnet/mvc/overview/getting-started/recommended-resources-for-mvc.md +++ b/aspnet/mvc/overview/getting-started/recommended-resources-for-mvc.md @@ -154,7 +154,6 @@ by [Rick Anderson](https://twitter.com/RickAndMSFT) - [ASP.NET MVC View Model: Entity Framework & JSON Serialization](http://www.dotnetexpertguide.com/2013/06/aspnet-mvc-view-model-entity-framework-json-serialization.html) Nandip Makwana shows a nice tip to increase performance (and lower CPU usage) by eliminating unnecessary serialization of child entities - [Async and Await](http://blog.stephencleary.com/2012/02/async-and-await.html) in ASP.NET by Stephen Cleary -- [Debugging and Performance using Glimpse](http://www.hanselman.com/blog/NuGetPackageOfTheWeek5DebuggingASPNETMVCApplicationsWithGlimpse.aspx) - [Improve perceived performance of ASP.NET MVC websites with asynchronous partial views](http://blog.michaelckennedy.net/2012/11/13/improve-perceived-performance-of-asp-net-mvc-websites-with-async-partialviews/) - [ASP.NET 4.5 & MVC 4: Revisiting IBundleTransform](http://www.dotnetexpertguide.com/2012/10/aspnet-45-mvc-4-revisiting-IBundleTransform-in-bundling.html) - [ASP.NET MVC 4: Cookieless domain for bundling and static resources](http://www.dotnetexpertguide.com/2012/10/aspnet-mvc-4-cookieless-domain-for-bundling-and-static-resources.html) diff --git a/aspnet/mvc/overview/performance/index.md b/aspnet/mvc/overview/performance/index.md index ab26c04c21..a9b2f2c8b7 100644 --- a/aspnet/mvc/overview/performance/index.md +++ b/aspnet/mvc/overview/performance/index.md @@ -14,6 +14,5 @@ msc.type: chapter > Resources for optimizing performance of ASP.NET MVC applications. - [Using Asynchronous Methods in ASP.NET MVC 4](using-asynchronous-methods-in-aspnet-mvc-4.md) -- [Profile and debug your ASP.NET MVC app with Glimpse](profile-and-debug-your-aspnet-mvc-app-with-glimpse.md) - [Bundling and Minification](bundling-and-minification.md) diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse.md b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse.md deleted file mode 100644 index 6166f06e4f..0000000000 --- a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse.md +++ /dev/null @@ -1,119 +0,0 @@ ---- -uid: mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse -title: "Profile and debug your ASP.NET MVC app with Glimpse | Microsoft Docs" -author: Rick-Anderson -description: "Glimpse is a thriving and growing family of open source NuGet packages that provides detailed performance, debugging and diagnostic information for ASP.NET a..." -ms.author: tdykstra -ms.date: 03/26/2015 -ms.assetid: c205805f-efdd-4fa7-9616-f26eab180611 -msc.legacyurl: /mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse -msc.type: authoredcontent ---- -# Profile and debug your ASP.NET MVC app with Glimpse - -by [Rick Anderson](https://twitter.com/RickAndMSFT) - -> Glimpse is a thriving and growing family of open source NuGet packages that provides detailed performance, debugging and diagnostic information for ASP.NET apps. It's trivial to install, lightweight, ultra-fast, and displays key performance metrics at the bottom of every page. It allows you to drill down into your app when you need to find out what's going on at the server. Glimpse provides so much valuable information we recommend you use it throughout your development cycle, including your Azure test environment. While [Fiddler](http://www.telerik.com/fiddler) and the [F-12 development tools](https://msdn.microsoft.com/library/ie/gg589512(v=vs.85).aspx) provide a client side view, Glimpse provides a detailed view from the server. This tutorial will focus on using the Glimpse ASP.NET MVC and EF packages, but many other packages are available. Where possible I will link to the appropriate [Glimpse docs](https://getglimpse.com/Docs/) which I help maintain. Glimpse is an open source project, you too can contribute to the source code and the docs. - -- [Installing Glimpse](#ig) -- [Enable Glimpse for localhost](#eg) -- [The Timeline tab](#Time) -- [Model Binding](#mb) -- [Routes](#route) -- [Using Glimpse on Azure](#da) -- [Additional Resources](#addRes) - - -## Installing Glimpse - -You can install Glimpse from the NuGet package manager console or from the **Manage NuGet Packages** console. For this demo, I'll install the Mvc5 and EF6 packages: - -![install Glimpse from NuGet Dlg](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image1.png) - -Search for *Glimpse.EF* - -![Glimpse.EF from NuGet install dlg](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image2.png) - -By selecting **Installed packages**, you can see the Glimpse dependent modules installed: - -![Installed Glimpse packages from DLg](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image3.png) - -The following commands install Glimpse MVC5 and EF6 modules from the package manager console: - -[!code-console[Main](profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample1.cmd)] - - -## Enable Glimpse for localhost - -Navigate to http://localhost:<port #>/glimpse.axd and click the Turn Glimpse On button. - -![Glimpse axd page](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image4.png) - -If you have your favorites bar displayed, you can drag and drop the Glimpse buttons and add them as bookmarklets: - -![IE with Glimpse bookmarklets](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image5.png) - -You can now navigate your app, and the **Heads Up Display** (HUD) is shown at the bottom of the page. - -![Contact Manager page with HUD](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image6.png) - -The Glimpse HUD page details the timing information shown above. The unobtrusive performance data the HUD displays can notify you of a problem immediately - before you get to the test cycle. Clicking on the "g" in the lower right corner brings up the Glimpse panel: - -![Glimpse panel](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image7.png) - -In the image above, the Execution tab is selected, which shows timing details of the actions and filters in the pipeline. You can see my [Stop Watch filter timer](https://www.nuget.org/packages/StopWatch/) start at stage 6 of the pipeline. While my light weight timer can provide useful profile/timing data, it misses all the time spent in authorization and rendering the view. You can read about my timer at [Profile and Time your ASP.NET MVC app all the way to Azure](https://devblogs.microsoft.com/dotnet/profile-and-time-your-asp-net-mvc-app-all-the-way-to-azure/). - - -## The Timeline tab - -I've modified Tom Dykstra's outstanding [EF 6/MVC 5 tutorial](../getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application.md) with the following code change to the instructors controller: - -[!code-csharp[Main](profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample2.cs?highlight=1,20-31)] - -The code above allows me to pass in query string (`eager`) to control eager or explicit loading of data. In the image below, explicit loading is used and the timing page shows each enrollment loaded in the `Index` action method: - -![explicit loading](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image8.png) - -In the following code, eager is specified, and each enrollment is fetched after the `Index` view is called: - -![eager is specified](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image9.png) - -You can hover over a time segment to get detailed timing information: - -![hover to see detailed timing](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image10.png) - - -## Model Binding - -The model binding tab provides a wealth of information to help you understand how your form variables are bound and why some are not bound as would expect. The image below shows the **?** icon, which you can click on to bring up the glimpse help page for that feature. - -![glimpse model binding view](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image11.png) - - -## Routes - - The Glimpse Routes tab will can help you debug and understand routing. In the image below, the product route is selected (and it shows in green, a Glimpse convention). ![product name selected](profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image12.png) Route constraints, Areas and data tokens are also displayed. See Glimpse Routes and [Attribute Routing in ASP.NET MVC 5](https://devblogs.microsoft.com/dotnet/attribute-routing-in-asp-net-mvc-5/) for more information. - - -## Using Glimpse on Azure - -The Glimpse default security policy only allows Glimpse data to be displayed from local host. You can change this security policy so you can view this data on a remote server (such as a web app on Azure). For test environments on Azure, add the highlighted mark up to the bottom of the *web.config* file to enable Glimpse: - -[!code-xml[Main](profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample3.xml?highlight=2-6)] - -With this change alone, any user can see your Glimpse data on a remote site. Consider adding the markup above to a publish profile so it's only deployed an applied when you use that publish profile (for example, your Azure test profile.) To restrict Glimpse data, we will add the `canViewGlimpseData` role and only allow users in this role to view Glimpse data. - -Remove the comments from the *GlimpseSecurityPolicy.cs* file and change the [IsInRole](https://msdn.microsoft.com/library/system.security.principal.iprincipal.isinrole(v=vs.110).aspx) call from `Administrator` to the `canViewGlimpseData` role: - -[!code-csharp[Main](profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample4.cs?highlight=6)] - -> [!WARNING] -> Security - The rich data provided by Glimpse could expose the security of your app. Microsoft has not performed a security audit of Glimpse for use on productions apps. - -For information on adding roles, see my [Deploy a Secure ASP.NET MVC 5 web app with Membership, OAuth, and SQL Database to Azure](https://azure.microsoft.com/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/) tutorial. - - -## Additional Resources - -- [Deploy a Secure ASP.NET MVC 5 app with Membership, OAuth, and SQL Database to Azure](https://azure.microsoft.com/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/) - diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image1.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image1.png deleted file mode 100644 index 26cbb29dc3..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image1.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image10.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image10.png deleted file mode 100644 index c01a77b2f7..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image10.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image11.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image11.png deleted file mode 100644 index f1caa3fa25..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image11.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image12.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image12.png deleted file mode 100644 index 5185592558..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image12.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image2.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image2.png deleted file mode 100644 index 7158b30f0f..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image2.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image3.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image3.png deleted file mode 100644 index 9406f6b465..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image3.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image4.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image4.png deleted file mode 100644 index 1b2d90bc1a..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image4.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image5.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image5.png deleted file mode 100644 index 92da8380f5..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image5.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image6.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image6.png deleted file mode 100644 index 4c991e47a7..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image6.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image7.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image7.png deleted file mode 100644 index 68aaa57ec8..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image7.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image8.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image8.png deleted file mode 100644 index 921e1ee31a..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image8.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image9.png b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image9.png deleted file mode 100644 index c3286c297b..0000000000 Binary files a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/_static/image9.png and /dev/null differ diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample1.cmd b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample1.cmd deleted file mode 100644 index eead36f381..0000000000 --- a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample1.cmd +++ /dev/null @@ -1,2 +0,0 @@ -PM> Install-Package Glimpse.MVC5 -PM> Install-Package Glimpse.EF6 \ No newline at end of file diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample2.cs b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample2.cs deleted file mode 100644 index 3fd2eedbde..0000000000 --- a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample2.cs +++ /dev/null @@ -1,45 +0,0 @@ -public ActionResult Index(int? id, int? courseID, int ? eager) -{ - var viewModel = new InstructorIndexData(); - - viewModel.Instructors = db.Instructors - .Include(i => i.OfficeAssignment) - .Include(i => i.Courses.Select(c => c.Department)) - .OrderBy(i => i.LastName); - - if (id != null) - { - ViewBag.InstructorID = id.Value; - viewModel.Courses = viewModel.Instructors.Where( - i => i.ID == id.Value).Single().Courses; - } - - if (courseID != null) - { - ViewBag.CourseID = courseID.Value; - // Eager loading - if (eager != null && eager > 0) - { - ViewBag.eagerMsg = "Eager Loading"; - - viewModel.Enrollments = viewModel.Courses.Where( - x => x.CourseID == courseID).Single().Enrollments; - - } - else { - // Explicit loading - ViewBag.eagerMsg = "Explicit Loading"; - - var selectedCourse = viewModel.Courses.Where(x => x.CourseID == courseID).Single(); - db.Entry(selectedCourse).Collection(x => x.Enrollments).Load(); - foreach (Enrollment enrollment in selectedCourse.Enrollments) - { - db.Entry(enrollment).Reference(x => x.Student).Load(); - } - - viewModel.Enrollments = selectedCourse.Enrollments; - } - } - - return View(viewModel); -} \ No newline at end of file diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample3.xml b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample3.xml deleted file mode 100644 index f4e5de8e87..0000000000 --- a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample3.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample4.cs b/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample4.cs deleted file mode 100644 index d06611fa05..0000000000 --- a/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse/samples/sample4.cs +++ /dev/null @@ -1,18 +0,0 @@ -public class GlimpseSecurityPolicy : IRuntimePolicy -{ - public RuntimePolicy Execute(IRuntimePolicyContext policyContext) - { - var httpContext = policyContext.GetHttpContext(); - if (!httpContext.User.IsInRole("canViewGlimpseData")) - { - return RuntimePolicy.Off; - } - - return RuntimePolicy.On; - } - - public RuntimeEvent ExecuteOn - { - get { return RuntimeEvent.EndRequest | RuntimeEvent.ExecuteResource; } - } -} \ No newline at end of file diff --git a/aspnet/toc.yml b/aspnet/toc.yml index 4b7adc80c7..e2b7037e5e 100644 --- a/aspnet/toc.yml +++ b/aspnet/toc.yml @@ -1822,8 +1822,6 @@ - name: Performance href: mvc/overview/performance/index.md items: - - name: Profile and debug your ASP.NET MVC app with Glimpse - href: mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse.md - name: Using Asynchronous Methods in ASP.NET MVC 4 href: mvc/overview/performance/using-asynchronous-methods-in-aspnet-mvc-4.md - name: Bundling and Minification diff --git a/aspnet/tutorials.md b/aspnet/tutorials.md index 700e8c3047..3dddb151a2 100644 --- a/aspnet/tutorials.md +++ b/aspnet/tutorials.md @@ -45,7 +45,6 @@ The following step-by-step guides for developing ASP.NET applications are availa * [XSRF/CSRF Prevention in ASP.NET MVC and Web Pages](mvc/overview/security/xsrfcsrf-prevention-in-aspnet-mvc-and-web-pages.md) * [Preventing Open Redirection Attacks (C#)](mvc/overview/security/preventing-open-redirection-attacks.md) * [Migrating ASP.NET MVC Applications to Windows Containers](mvc/overview/deployment/docker-aspnetmvc.md) -* [Profile and debug your ASP.NET MVC app with Glimpse](mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse.md) * [Using Asynchronous Methods in ASP.NET MVC 4](mvc/overview/performance/using-asynchronous-methods-in-aspnet-mvc-4.md) * [How to Upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2](mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2.md)