Created
December 30, 2016 07:30
-
-
Save stefan2410/ab802ce4e9dc1e65842ab650c5474a0a to your computer and use it in GitHub Desktop.
main method for WebListener in ASP.Net Core 1.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.Net.Http.Server; | |
using Microsoft.Extensions.Configuration; | |
namespace RazorRockstars.WebHost | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
/* | |
var host = new WebHostBuilder() | |
.UseKestrel() | |
.UseContentRoot(Directory.GetCurrentDirectory()) | |
.UseIISIntegration() | |
.UseStartup<Startup>() | |
.Build(); | |
host.Run(); | |
*/ | |
Console.WriteLine("Running demo with WebListener."); | |
var config = new ConfigurationBuilder() | |
.AddCommandLine(args) | |
.Build(); | |
var builder = new WebHostBuilder() | |
.UseContentRoot(Directory.GetCurrentDirectory()) | |
.UseConfiguration(config) | |
.UseStartup<Startup>() | |
.UseWebListener(options => | |
{ | |
options.ListenerSettings.Authentication.Schemes = AuthenticationSchemes.None; | |
options.ListenerSettings.Authentication.AllowAnonymous = true; | |
}); | |
var host = builder.Build(); | |
host.Run(); | |
return; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment