public static void Main(string[] args) { // This sample shows the current working prototype that fixes the application base on .NET Framework. // This is important so that configuration files, static files and razor views can be found by libraries // referenced by the application. // In the other samples, the application base points to where the ".exe" is located. This is problematic // at development time because it means static files, views and configuration files need to be copied (via compile) // before running. // The side effects are that anything above the call to ExecuteInChildAppDomain will be executed twice // on .NET Framework and Mono. #if NET451 Console.WriteLine($"AppDomain.Id = {AppDomain.CurrentDomain.Id}"); Console.WriteLine($"AppDomain.FriendlyName = {AppDomain.CurrentDomain.FriendlyName}"); Console.WriteLine($"AppDomain.BaseDirectory = {AppDomain.CurrentDomain.BaseDirectory}"); Console.WriteLine($"AppDomain.PrivateBinPath = {AppDomain.CurrentDomain.SetupInformation.PrivateBinPath}"); WebHost.ExecuteInChildAppDomain(args); #endif var configuration = WebApplicationConfiguration.GetDefault(args); // The real application logic goes here var application = new WebApplicationBuilder() .UseConfiguration(configuration) .UseStartup <Startup>() .Build(); application.Run(); }
public static void Main(string[] args) { var application = new WebApplicationBuilder() .UseConfiguration(WebApplicationConfiguration.GetDefault(args)) .UseStartup <Startup>() .Build(); application.Run(); }
public static void Main(string[] args) { var configuration = WebApplicationConfiguration.GetDefault(args); var host = new WebApplicationBuilder() .UseStartup <Startup>() .UseConfiguration(configuration) .Build(); host.Run(); }
public static void Main(string[] args) { var app = new WebApplicationBuilder() .UseServer("Microsoft.AspNet.Server.Kestrel") .UseConfiguration(WebApplicationConfiguration.GetDefault(args)) .UseStartup <Startup>() .Build(); app.Run(); }
public static void Main(string[] args) { var application = new WebApplicationBuilder() .UseConfiguration(WebApplicationConfiguration.GetDefault(args)) .UseStartup <Startup>() .Build(); // The following section should be used to demo sockets //var addresses = application.GetAddresses(); //addresses.Clear(); //addresses.Add("http://unix:/tmp/kestrel-test.sock"); application.Run(); }
protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners() { // Build an ASP.NET 5 web application that serves as the communication listener. var webApp = new WebApplicationBuilder().UseConfiguration(WebApplicationConfiguration.GetDefault()) .UseStartup <Startup>() .Build(); // Replace the address with the one dynamically allocated by Service Fabric. var endpoint = ServiceInitializationParameters.CodePackageActivationContext.GetEndpoint("GatewayTypeEndpoint"); webApp.GetAddresses().Clear(); webApp.GetAddresses().Add($"{endpoint.Protocol}://+:{endpoint.Port}"); return(new[] { new ServiceInstanceListener(_ => new AspNetCommunicationListener(webApp)) }); }
public static void Main(string[] args) { Console.WriteLine("Args:\n" + string.Join("\n", args)); var config = WebApplicationConfiguration.GetDefault(args); var application = new WebApplicationBuilder() .UseConfiguration(config) .UseStartup <Startup>() .Build(); var addresses = application.GetAddresses(); Console.WriteLine("Listening on " + string.Join(", ", addresses)); try { application.Run(); } finally { Console.WriteLine("Exiting..."); } }