mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
implement dispatch server
This commit is contained in:
61
WebServer/WebProgram.cs
Normal file
61
WebServer/WebProgram.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using EggLink.DanhengServer.Util;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using System.Net;
|
||||
|
||||
namespace EggLink.DanhengServer.WebServer
|
||||
{
|
||||
public class WebProgram
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
BuildWebHost(args).Start();
|
||||
}
|
||||
|
||||
public static IWebHost BuildWebHost(string[] args) =>
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.UseStartup<Startup>()
|
||||
.UseKestrel(options =>//ÉèÖÃKestrel·þÎñÆ÷
|
||||
{
|
||||
options.Listen(IPAddress.Any, 443, listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(
|
||||
ConfigManager.Config.KeyStore.KeyStorePath,
|
||||
ConfigManager.Config.KeyStore.KeyStorePassword);
|
||||
});
|
||||
})
|
||||
.ConfigureLogging((hostingContext, logging) =>
|
||||
{
|
||||
logging.ClearProviders();
|
||||
})
|
||||
.Build();
|
||||
}
|
||||
|
||||
public class Startup
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddControllers();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user