fix: v6版本支持系统服务

This commit is contained in:
Diego2098
2024-04-25 19:40:18 +08:00
parent fef6259d09
commit b9956ba800

View File

@@ -17,6 +17,7 @@ using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.AspNetCore.SignalR;
using Microsoft.AspNetCore.StaticFiles;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Unicode;
@@ -63,6 +64,11 @@ public class Program
#region config
var builder = WebApplication.CreateBuilder(args);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
builder.Host.UseWindowsService();
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
builder.Host.UseSystemd();
// 增加中文编码支持网页源码显示汉字
builder.Services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));