You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using SlnMesnac.Config;
|
|
using SlnMesnac.Quartz;
|
|
using TouchSocket.Sockets;
|
|
using SlnMesnac.Extensions;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Serilog;
|
|
using Autofac.Extensions.DependencyInjection;
|
|
|
|
namespace ConsoleApp
|
|
{
|
|
internal class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
var host = CreateHostBuilder(args).Build();//生成宿主。
|
|
|
|
host.StartAsync();
|
|
var appConfig = host.Services.GetService<AppConfig>();
|
|
var logPath = $"{appConfig.logPath}/Logs/{DateTime.UtcNow:yyyy-MM-dd}/";
|
|
Log.Information($"系统初始化完成,日志存放路径:{appConfig.logPath}");
|
|
Console.ReadLine();
|
|
}
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.UseSerilog()
|
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
{
|
|
webBuilder.UseStartup<Startup>();
|
|
});
|
|
}
|
|
}
|