Пример #1
0
        public static IWebHost BuildWebHost(string[] args) =>
        WebHost.CreateDefaultBuilder(args).UseKestrel(options =>
        {
            if (EnvHelper.IsDevelopmentEnvironment())
            {
                Console.WriteLine("Using development environment");
                options.Listen(IPAddress.Loopback, 5001, listenOptions =>
                {
                    if (File.Exists("devcert.pfx"))
                    {
                        listenOptions.UseHttps("devcert.pfx", "dev");
                    }
                    else
                    {
                        throw new FileNotFoundException("SSL Certificate Not Found (devcert.pfx)");
                    }
                });
            }
        })
        .UseIISIntegration()
        .UseStartup <Startup>()

        .Build();