Force _IsWindowsService and change log level

This commit is contained in:
2023-11-16 16:12:10 -07:00
parent 3f7b95c916
commit 58c4b9e487
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
using File_Watcher.Models;
using Microsoft.Extensions.Hosting.WindowsServices;
using System.Data;
namespace File_Watcher;
@ -41,6 +42,8 @@ public partial class Worker : BackgroundService
private async Task Body(CancellationToken stoppingToken)
{
if (!_IsWindowsService)
throw new EvaluateException("Set break point and skip!");
while (_IsWindowsService && !stoppingToken.IsCancellationRequested)
{
Body();