.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守护神 阅读(...) 评论(...) 编辑 收藏