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.

63 lines
2.3 KiB
C#

1 year ago
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Admin.Core.Api
{
/// <summary>
/// Program
/// </summary>
public class Program
{
/// <summary>
/// Main
/// </summary>
/// <param name="args"></param>
public static void Main(string[] args)
{
CreateHostBuilder(args)
// <20><><EFBFBD>ɳ<EFBFBD><C9B3><EFBFBD> web Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD> Microsoft.AspNetCore.Hosting.IWebHost<73><74>Build<6C><64>WebHostBuilder<65><72><EFBFBD>յ<EFBFBD>Ŀ<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>WebHost<73><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.Build()
// <20><><EFBFBD><EFBFBD> web Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>, ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رա<D8B1>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><ECB3A3><EFBFBD>鿴 Log <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><ECB3A3>־ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.Run();
}
/// <summary>
/// CreateHostBuilder
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
public static IHostBuilder CreateHostBuilder(string[] args) =>
//<2F><>ʼ<EFBFBD><CABC>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Builder
Host.CreateDefaultBuilder(args)
//Autofac<61><63><EFBFBD>񹤳<EFBFBD>
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseIIS().UseStartup<Startup>();
})
.ConfigureLogging((hostingContext, builder) =>
{
// 1.<2E><><EFBFBD>˵<EFBFBD>ϵͳĬ<CDB3>ϵ<EFBFBD>һЩ<D2BB><D0A9>־
builder.AddFilter("System", LogLevel.Error);
builder.AddFilter("Microsoft", LogLevel.Error);
// 2.Ҳ<><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>appsettings.json<6F><6E><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>LogLevel<65>ڵ<EFBFBD>
// 3.ͳһ<CDB3><D2BB><EFBFBD><EFBFBD>
builder.SetMinimumLevel(LogLevel.Error);
// Ĭ<><C4AC>log4net.confg
builder.AddLog4Net(Path.Combine(Directory.GetCurrentDirectory(), "Log4net.config"));
});
}
}