星尘工厂自动注册,简化使用成本
智能石头 authored at 2021-03-17 22:11:28
770.00 B
Stardust
using System;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using NewLife.Log;

namespace Stardust.Server
{
    public class Program
    {
        public static void Main(String[] args)
        {
            XTrace.UseConsole();

            CreateWebHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateWebHostBuilder(String[] args)
        {
            var builder = Host.CreateDefaultBuilder(args);
            builder.ConfigureWebHostDefaults(webBuilder =>
            {
                var set = Setting.Current;
                if (set.Port > 0) webBuilder.UseUrls($"http://*:{set.Port}");
                webBuilder.UseStartup<Startup>();
            });

            return builder;
        }
    }
}