37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using Furion;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Ewide.Nbzs.BackWorkerService
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
CreateHostBuilder(args).Build().Run();
|
|
}
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.UseWindowsService()
|
|
.Inject()
|
|
.ConfigureServices((hostContext, services) =>
|
|
{
|
|
services.AddHostedService<Worker>();
|
|
services.AddStackExchangeRedisCache(options =>
|
|
{
|
|
// 连接字符串,这里也可以读取配置文件
|
|
options.Configuration = App.GetConfig<string>("RedisConfig");
|
|
// 键名前缀
|
|
options.InstanceName = "zlb_";
|
|
});
|
|
}).UseSerilogDefault();
|
|
}
|
|
}
|