63 lines
1.8 KiB
C#
63 lines
1.8 KiB
C#
using System;
|
|
using System.Security.Authentication;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Serilog;
|
|
using ZhiZhun.AuthenticationCenter;
|
|
|
|
namespace Zhaoxi.NET6.AuthenticationCenter
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
Log.Logger = new LoggerConfiguration()
|
|
.MinimumLevel.Information()
|
|
.WriteTo.File("logs\\log.txt",
|
|
rollingInterval: RollingInterval.Day,
|
|
rollOnFileSizeLimit: true)
|
|
.CreateLogger();
|
|
|
|
try
|
|
{
|
|
CreateHostBuilder(args).Build().Run();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Log.Information(e.ToString());
|
|
}
|
|
|
|
}
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args)
|
|
{
|
|
|
|
var configuration = new ConfigurationBuilder().SetBasePath(Environment.CurrentDirectory)
|
|
.AddJsonFile("appsettings.json")
|
|
.Build();
|
|
|
|
return Host.CreateDefaultBuilder(args)
|
|
.UseWindowsService()
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
{
|
|
webBuilder.ConfigureKestrel(options =>
|
|
{
|
|
//如果放在内网,不想用https 那么需要在这里设置
|
|
//Setup a HTTP / 2 endpoint without TLS.
|
|
options.ListenLocalhost(7200, o => o.Protocols =
|
|
HttpProtocols.Http2);
|
|
|
|
});
|
|
|
|
webBuilder.UseUrls(configuration["ApplicationUrl"]);
|
|
|
|
|
|
webBuilder.UseStartup<Startup>();
|
|
});
|
|
}
|
|
|
|
}
|
|
}
|