Beispiel #1
0
        public static void Main(string[] args)
        {
            if (Environment.GetEnvironmentVariable("ASPNET_ENV") == "Debug")
            {
                // Build an ASP.NET 5 web application that serves as the communication listener.
                var webApp = new WebApplicationBuilder().UseConfiguration(WebApplicationConfiguration.GetDefault())
                                                        .ConfigureLogging(factory =>
                                                        {
                                                            factory.AddConsole();
                                                        })
                                                        .UseStartup<Startup>()
                                                        .Build();

                // Replace the address with the one dynamically allocated by Service Fabric.
                webApp.GetAddresses().Clear();
                webApp.GetAddresses().Add(ListeningAddress);
                webApp.Run();

                Thread.Sleep(Timeout.Infinite);

            }
            else
            {
                using (var fabricRuntime = FabricRuntime.Create())
                {
                    fabricRuntime.RegisterServiceType("MicroserviceTemplateType", typeof(MicroserviceTemplate));

                    Thread.Sleep(Timeout.Infinite);
                }
            }
        }
        public static void Main(string[] args)
        {
            var application = new WebApplicationBuilder()
                .UseServer("Microsoft.AspNet.Server.Kestrel") // Set the server manually
                .UseApplicationBasePath(Directory.GetCurrentDirectory()) // Override the application base with the current directory
                .UseUrls("http://*:1000", "https://*:902")
                .UseEnvironment("Development")
                .UseWebRoot("public")
                .ConfigureServices(services =>
                {
                    // Configure services that the application can see
                    services.AddSingleton<IMyCustomService, MyCustomService>();
                })
                .Configure(app =>
                {
                    // Write the application inline, this won't call any startup class in the assembly

                    app.Use(next => context =>
                    {
                        return next(context);
                    });
                })
                .Build();

            application.Run();
        }
Beispiel #3
0
        public static void Main(string[] args)
        {
            var application = new WebApplicationBuilder()
                .UseConfiguration(WebApplicationConfiguration.GetDefault(args))
                .UseStartup<Startup>()
                .Build();

            application.Run();
        }
        // Entry point for the application.
        public static void Main(string[] args)
        {
            var app = new WebApplicationBuilder()
                .UseServer("Microsoft.AspNet.Server.Kestrel")
                .UseUrls("http://localhost:3333")
                .UseStartup<Startup>()
                .Build();

            app.Run();
        }
        // Entry point for the application.
        public static void Main(string[] args)
        {
            var app = new WebApplicationBuilder()
                .UseServer("Microsoft.AspNet.Server.Kestrel")
                .UseConfiguration(WebApplicationConfiguration.GetDefault(args))
                .UseStartup<Startup>()
                .Build();

            app.Run();
        }
        // Entry point for the application.
        public static void Main(string[] args)
        {
            var config = WebApplicationConfiguration.GetDefault(args);

            var application = new WebApplicationBuilder()
                .UseConfiguration(config)
                .UseStartup<StartupHelloWorld>()
                .Build();

            application.Run();
        }
        // Entry point for the application.
        public static void Main(string[] args)
        {
            var config = WebApplicationConfiguration.GetDefault(args);

            var application = new WebApplicationBuilder()
                .UseConfiguration(config)
                .UseStartup<StartupConfigureAddresses>()
                .UseUrls("http://localhost:5000", "http://localhost:5001")
                .Build();

            application.Run();
        }
        public static void Main(string[] args)
        {
            var hostingConfiguration = WebApplicationConfiguration.GetDefault(args);

            var app = new WebApplicationBuilder()
                .UseConfiguration(hostingConfiguration)
                .UseEnvironment(EnvironmentName.Development)
                .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();
        }
Beispiel #10
0
        public static void Main(string[] args)
        {
            if (Environment.GetEnvironmentVariable("ASPNET_ENV") == "Debug")
            {
                try
                {
                    // Build an ASP.NET 5 web application that serves as the communication listener.
                    var webApp = new WebApplicationBuilder().UseConfiguration(WebApplicationConfiguration.GetDefault())
                                                            .ConfigureLogging(factory =>
                                                            {
                                                                factory.AddConsole();
                                                            })
                                                            .UseStartup<Startup>()
                                                            .Build();

                    webApp.GetAddresses().Clear();
                    webApp.GetAddresses().Add(LocalListeningAddress);
                    Console.WriteLine(LocalListeningAddress);
                    webApp.Run();
                    Thread.Sleep(Timeout.Infinite);

                }
                catch (Exception ex)
                {
                    Console.WriteLine("Crashed: {0}", ex);
                    Console.ReadLine();
                }

            }

            using (var fabricRuntime = FabricRuntime.Create())
            {
                fabricRuntime.RegisterServiceType("ServiceDeployerType", typeof(ServiceDeployer));

                Thread.Sleep(Timeout.Infinite);
            }
        }