github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/examples/dotnet/web-new/example/Program.cs (about)

     1  using Microsoft.AspNetCore;
     2  using Microsoft.AspNetCore.Builder;
     3  using Microsoft.AspNetCore.Hosting;
     4  using Microsoft.AspNetCore.Http;
     5  
     6  public static class Program
     7  {
     8      public static void Main()
     9      {
    10          WebHost.CreateDefaultBuilder()
    11              .Configure(app =>
    12              {
    13                  app.UseRouting();
    14                  app.UseEndpoints(endpoints =>
    15                  {
    16                      endpoints.MapGet("/", async context =>
    17                      {
    18                          var j = 0;
    19                          for (var i = 0; i < 100000000; i++) j++;
    20                          await context.Response.WriteAsync("Hello!");
    21                      });
    22                  });
    23              })
    24              .Build()
    25              .Run();
    26      }
    27  }