public static IWebHostBuilder UseKestrelGuardiansConfigWithStandardEndpoints(this IWebHostBuilder builder, string[] args) { builder.UseSetting("https_port", "443") .UseSetting("http_endpoint", "0.0.0.0") .UseSetting("http_port", "80") .UseSetting("https_endpoint", @"0.0.0.0") .UseUrls(@"http://0.0.0.0:80", @"https://0.0.0.0:443"); builder.ConfigureKestrelHostWithCommandlinArgs(args, false); return(builder); }
/// <summary> /// Registers Kestrl using <see cref="WebHostBuilderKestrelExtensions"/>'s UseKestrl. /// Optionally abstracts configuration for local vs deploy vs AWS registeration. /// </summary> /// <param name="builder">The builder.</param> /// <returns>The builder.</returns> public static IWebHostBuilder UseKestrelGuardiansConfig(this IWebHostBuilder builder, string[] args, bool shouldUseDefaultUrlIfNoneProvided = true) { //If we're local then we don't want to set this IP //because it won't work. Since we won't be on our own EC2 instance with IIS #if !DEBUG_LOCAL && !RELEASE_LOCAL builder .UseKestrel() .UseUrls(@"http://0.0.0.0:7777"); #else builder.ConfigureKestrelHostWithCommandlinArgs(args, shouldUseDefaultUrlIfNoneProvided); #endif return(builder); }