mirror of
				https://gitee.com/dotnetchina/OpenAuth.Net.git
				synced 2025-10-25 18:29:01 +08:00 
			
		
		
		
	
		
			
	
	
		
			43 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			43 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
|   | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. | |||
|  | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. | |||
|  | 
 | |||
|  | 
 | |||
|  | using System; | |||
|  | 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) | |||
|  |         { | |||
|  |             Console.Title = "IdentityServer4"; | |||
|  | 
 | |||
|  |             CreateWebHostBuilder(args).Build().Run(); | |||
|  |         } | |||
|  | 
 | |||
|  |         public static IHostBuilder CreateWebHostBuilder(string[] args) | |||
|  |         { | |||
|  |             return Host.CreateDefaultBuilder(args) | |||
|  |                 .UseServiceProviderFactory(new AutofacServiceProviderFactory())   //将默认ServiceProviderFactory指定为AutofacServiceProviderFactory | |||
|  |                 .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); | |||
|  |                     }); | |||
|  |         } | |||
|  |     } | |||
|  | } |