Skip to Content
C# 7 and .NET Core 2.0 High Performance
book

C# 7 and .NET Core 2.0 High Performance

by Ovais Mehboob Ahmed Khan
April 2018
Intermediate to advanced
300 pages
7h 41m
English
Packt Publishing
Content preview from C# 7 and .NET Core 2.0 High Performance

Setting up App Metrics with ASP.NET Core

We can set up App Metrics in the ASP.NET Core application in three easy steps, which are as follows:

  1. Install App Metrics.

App Metrics can be installed as NuGet packages. Here are the two packages that can be added through NuGet in your .NET Core project:

      Install-Package App.Metrics 
      Install-Pacakge App.Metrics.AspnetCore.Mvc 
  1. Add App Metrics in Program.cs.

Add UseMetrics to Program.cs in the BuildWebHost method, as follows:

      public static IWebHost BuildWebHost(string[] args) => 
        WebHost.CreateDefaultBuilder(args) 
          .UseMetrics() 
          .UseStartup<Startup>() 
          .Build(); 
  1. Add App Metrics in Startup.cs.

Finally, we can add a metrics resource filter in the ConfigureServices method of the Startup class as follows: ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Professional C# 7 and .NET Core 2.0, 7th Edition

Professional C# 7 and .NET Core 2.0, 7th Edition

Christian Nagel
Pro ASP.NET Web API: HTTP Web Services in ASP.NET

Pro ASP.NET Web API: HTTP Web Services in ASP.NET

Tugberk Ugurlu, Alexander Zeitler, Ali Kheyrollahi
Enterprise Application Development with C# 9 and .NET 5

Enterprise Application Development with C# 9 and .NET 5

Ravindra Akella, Rishabh Verma, Arun Kumar Tamirisa, Suneel Kumar Kunani, Bhupesh Guptha Muthiyalu

Publisher Resources

ISBN: 9781788470049Supplemental Content