Enable Server GC in .NET Core

To enable Server GC, modify the runtimeconfig.json file or add the following to your app settings:

{
  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  }
}


Alternatively, you can configure GC in ASP.NET Core apps by editing Program.cs:

public static void Main(string[] args)
{
    var host = Host.CreateDefaultBuilder(args)
        .UseServerGC()  // Enables Server GC mode
        .Build();

    host.Run();
}