.NET Core:多样的宿主

   .NET Core 可以以以下方式作为宿主运行:
  1. IIS
  2. 控制台
  3. Windows服务
  运行启动代码:
        public static void Main(string[] args)
        {
            try
            {
                LogCenter.Info("系统启动");
                LoadConfig();
                bool isService = !(Debugger.IsAttached ||  args.Contains("--console"));
                if (isService)
                {
                    CreateWebHostBuilder(args).Build().RunAsService();
                }
                else
                {
                    CreateWebHostBuilder(args).Build().Run();
                }
            }
            catch (Exception ex)
            {
                LogCenter.Error(ex);
            }
        }
posted @ 2018-12-18 16:00  M守护神  阅读(1156)  评论(0编辑  收藏  举报