WrokService.cs 456 B

12345678910111213141516171819
  1. using Microsoft.Extensions.Hosting;
  2. using System.Diagnostics;
  3. using System.Threading;
  4. using System.Threading.Tasks;
  5. namespace rediswebapiTest
  6. {
  7. public class WrokService : BackgroundService
  8. {
  9. protected override Task ExecuteAsync(CancellationToken stoppingToken)
  10. {
  11. while (true)
  12. {
  13. Task.Delay(100).Wait();
  14. Debug.WriteLine("BackgroundService");
  15. }
  16. }
  17. }
  18. }