Alternative solution to HostingEnvironment.QueueBackgroundWorkItem in .NET Core

后端 未结 6 1859
栀梦
栀梦 2020-12-23 11:04

We are working with .NET Core Web Api, and looking for a lightweight solution to log requests with variable intensity into database, but don\'t want client\'s to wait for th

6条回答
  •  死守一世寂寞
    2020-12-23 11:43

    You can use Hangfire (http://hangfire.io/) for background jobs in .NET Core.

    For example :

    var jobId = BackgroundJob.Enqueue(
        () => Console.WriteLine("Fire-and-forget!"));
    

提交回复
热议问题