using Aucma.Core.TemperatureTask; using log4net; using Microsoft.AspNetCore.Builder; using System; namespace Admin.Core.Extensions.Middlewares { public static class TemperatureTaskMildd { private static readonly ILog log = LogManager.GetLogger(typeof(AucamSheetMetalTaskMildd)); public static void UseTemperatureTaskMildds(this IApplicationBuilder app, IAucamTemperatureMeasurementService aucamTemperatureMeasurementService) { if (app == null) throw new ArgumentNullException(nameof(app)); try { aucamTemperatureMeasurementService.Execute(); Console.WriteLine("测温服务已开启"); } catch (Exception e) { log.Error($"An error was reported when starting the job service.\n{e.Message}"); throw; } } } }