Net Core 3.0 及 AspNet 3.0

AspNet 3.0 的启动与配置:

1、Host 、IHost 通用主机,

     官方文档: https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/host/generic-host?view=aspnetcore-3.0

2、IHostBuilder 建造器:

      初级知识:接口的方法参数,很多都采用 Lamada 函数,=> 是标志,函数的参数可能就是需要配置的目标,并返回作为整个应用系统的设置。

      方法 ConfigureHostConfiguration() 配置主机:

          configHost => {

                    configHost.SetBasePath(Directory.GetCurrentDirectory());
                    configHost.AddJsonFile("hostsettings.json", optional: true);
                    configHost.AddEnvironmentVariables(prefix: "PREFIX_");
                    configHost.AddCommandLine(args);
                }

      方法 ConfigureAppConfiguration()配置应用:

猜你喜欢

转载自www.cnblogs.com/hopesun/p/11621579.html