服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-04-29 70907b733057d1df1657f597e245757ab31e749f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Rhea.Common;
using Microsoft.AspNetCore.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Threading.Tasks;
using Tiger.IBusiness;
 
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");
            }
        }
    }
}