From 9e69f34c93e7193d80dc207db7b6ce22743dcafc Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 09 十月 2024 23:22:27 +0800 Subject: [PATCH] 工单未配置工艺路线不能下发,YadaU9C数据连接 --- Tiger.Api/ApiWebHostService.cs | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/Tiger.Api/ApiWebHostService.cs b/Tiger.Api/ApiWebHostService.cs index 3bead49..be53ff7 100644 --- a/Tiger.Api/ApiWebHostService.cs +++ b/Tiger.Api/ApiWebHostService.cs @@ -6,9 +6,26 @@ using System.Threading.Tasks; using Rhea.Common; using Tiger.IBusiness; +using System.ServiceProcess; namespace Tiger.Api { + public static class WebHostServiceExtensions + { + public static void RunAsApiService(this IWebHost host) + { + try + { + var webHostService = new ApiWebHostService(host); + ServiceBase.Run(webHostService); + } + catch (System.Exception ex) + { + Logger.Console.Fatal(ex, "Windows Services Exception"); + } + } + } + internal class ApiWebHostService : WebHostService { public ApiWebHostService(IWebHost host) : base(host) @@ -39,7 +56,7 @@ DI.Resolve<IServicesBus>().StopServices(); //鍏抽棴DB缂撳瓨鑷姩鏇存柊 DI.Resolve<IDbCacheBus>().StopAutoUpdate(); - MQTTHelper.MQTTConn?.Close(); + //MQTTHelper.MQTTConn?.Close(); base.OnStopping(); } catch (System.Exception ex) -- Gitblit v1.9.3