2026-06-25 23:42:43 +08:00
|
|
|
|
using System;
|
2020-10-22 14:59:36 +08:00
|
|
|
|
using Autofac.Extensions.DependencyInjection;
|
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
|
using Serilog;
|
|
|
|
|
|
using Serilog.Events;
|
|
|
|
|
|
using Serilog.Sinks.SystemConsole.Themes;
|
|
|
|
|
|
|
|
|
|
|
|
namespace OpenAuth.IdentityServer
|
|
|
|
|
|
{
|
|
|
|
|
|
public class Program
|
|
|
|
|
|
{
|
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
|
{
|
2026-06-25 23:42:43 +08:00
|
|
|
|
Console.Title = "OpenAuth.IdentityServer (OpenIddict)";
|
2020-10-22 14:59:36 +08:00
|
|
|
|
|
|
|
|
|
|
CreateWebHostBuilder(args).Build().Run();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static IHostBuilder CreateWebHostBuilder(string[] args)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Host.CreateDefaultBuilder(args)
|
2026-06-25 23:42:43 +08:00
|
|
|
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
2020-10-22 14:59:36 +08:00
|
|
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
|
|
|
|
{
|
|
|
|
|
|
webBuilder.UseUrls("http://*:12796").UseStartup<Startup>();
|
|
|
|
|
|
}).UseSerilog((context, configuration) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
configuration
|
|
|
|
|
|
.MinimumLevel.Debug()
|
|
|
|
|
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
|
|
|
|
|
.MinimumLevel.Override("System", LogEventLevel.Warning)
|
|
|
|
|
|
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
|
|
|
|
|
|
.Enrich.FromLogContext()
|
|
|
|
|
|
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Literate);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-06-25 23:42:43 +08:00
|
|
|
|
}
|