支持注册Windows服务

This commit is contained in:
falcon 2020-04-10 18:19:42 +08:00
parent 7ee12e8bf7
commit 76741ec96e
2 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Falcon.Extend" Version="1.2.1" /> <PackageReference Include="Falcon.Extend" Version="1.2.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.3" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.3" />
<PackageReference Include="NLog" Version="4.7.0" /> <PackageReference Include="NLog" Version="4.7.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.1" /> <PackageReference Include="NLog.Web.AspNetCore" Version="4.9.1" />

View File

@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using NLog.Web; using NLog.Web;
using Microsoft.Extensions.Hosting.WindowsServices;
namespace FAuth namespace FAuth
{ {
@ -27,11 +28,11 @@ namespace FAuth
.ConfigureWebHostDefaults(webBuilder => { .ConfigureWebHostDefaults(webBuilder => {
webBuilder.UseStartup<Startup>(); webBuilder.UseStartup<Startup>();
}) })
.UseWindowsService()
.ConfigureLogging(c => { .ConfigureLogging(c => {
c.ClearProviders(); c.ClearProviders();
c.SetMinimumLevel(LogLevel.Trace); c.SetMinimumLevel(LogLevel.Trace);
}) })
.UseNLog(); .UseNLog();
} }
} }