Loupe - Log - Monitor - Resolve
Loupe / Getting Started / .NET Core / .NET 5 / Using Loupe with .NET Core & .NET 5
In This Topic
    Using Loupe with .NET Core & .NET 5
    In This Topic

    To cater to the unique needs of .NET Core Loupe has a dedicated stack of agents designed for .NET Standard 2.0 and later / .NET Core 2.1.  Additional agents build on top of the core agent to provide additional logging and diagnostics for ASP.NET Core and Entity Framework Core.

    While ASP.NET Core and EF Core support applications developed for the .NET Framework the Loupe agents are designed to work on top of the Loupe Agent for .NET Core exclusively at this time.  If you need them to work for .NET Framework, contact our support team for how to build them for this situation.
     Adding the Loupe Agent to your Application

    Add the the following NuGet packages to get Loupe and its relevant dependencies:

    1. Loupe.Agent.Core.Services: A small package with configuration builders for .NET Core.
    2. Loupe.Extensions.Logging (Optional): Connects Loupe with the Microsoft.Extensions.Logging infrastructure which is used by .NET for common logging.
    3. Loupe.Agent.EntityFrameworkCore (Optional): Connects Loupe with EF Core to record performance and diagnostic information for EF Core.
    4. Loupe.Agent.PerformanceCounters (Optional): Records a collection of Windows Performance Counters on Windows systems.

    The recommended way to activate the Loupe Agent is to add it to the Host Builder setup, typically in Program.cs, like this:

    Host Builder Example for Program.cs
    Copy Code
        public static IHostBuilder CreateHostBuilder(string[] args) =>
                .AddLoupe(builder => builder.AddEntityFrameworkCoreDiagnostics()

    .NET Core uses a different, more flexible, approach to application configuration than .NET Framework applications.  Instead of XML config files .NET Core has an entire extensible configuration subsystem that can be used.  In most situations you'll do a combination of coded configuration and JSON configuration.  For details, see Developer's Guide - Agent Configuration.

    Once you've instrumented an application you'll want to set up a connection with Loupe Server so you can collect data from everywhere your application runs and start managing errors.  Add this configuration to your appsettings.json file to send data to this server automatically in the background.  You'll need to make a few changes to this JSON to have it work:

    • Replace "Your Loupe Service Name" with the name of your Loupe Cloud-hosted Service.  If you don't have one yet, sign up for a free trial service.
    • Replace "Your Product" and "Your Application" with friendly values for your application.  A good analogy for Product is "Office" and Application is "Word", "Excel", and "PowerPoint". 
      "Logging": {
        "IncludeScopes": false,
        "LogLevel": {
          "Default": "Warning"
      "Loupe": {
        "Publisher": {
          "ProductName": "Your Product",
          "ApplicationName": "Your Application",
          "ApplicationType": "AspNet",
          "ApplicationVersionNumber": "1.0.1"
        "Server": {
          "UseGibraltarService": true,
          "CustomerName": "Your Loupe Service Name",
          "AutoSendSessions": true,
          "SendAllApplications": true

     Packaging and Sending Loupe Data from your Application
    The Loupe Agent provides a comprehensive set of capabilities to gather the session data recorded while your application runs and send it to where you can work with it to fix customer issues, understand feature usage, and drive your product development forward.  To determine the best approach for your situation, see Developer's Guide - Packaging and Sending Data.
    See Also