Example #1
0
        private void BConfigureClick(object sender, EventArgs e)
        {
            bConfigure.Enabled = false;
            ConfigureApplication appConfig = new ConfigureApplication(_controller);

            appConfig.Disposed += delegate { bConfigure.Enabled = true; };
            DisplayDialog(appConfig, false);
        }
Example #2
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });

            ConfigureApplication.AddApplicationServices(services);
            ConfigureInfrastructure.AddInfrastructureServices(services, Configuration);
        }
        /// <summary>
        /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        /// </summary>
        /// <param name="app"></param>
        /// <param name="env"></param>
        /// <param name="mapper"></param>
        /// <param name="loggerFactory"></param>
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, AutoMapper.IConfigurationProvider mapper, ILoggerFactory loggerFactory)
        {
            if (env.IsDevelopment())
            {
                mapper.AssertConfigurationIsValid();
            }
            else
            {
                mapper.CompileMappings();
            }

            ConfigureApplication.Configure(app, env, loggerFactory);
        }
        private IWebHost Build(IReadOnlyCollection <string> hostnames)
        {
            if (_host != default)
            {
                throw new RedHttpServerException("The server is already running");
            }
            Initialize();
            var urls = hostnames.Count != 0
                ? hostnames.Select(url => $"http://{url}:{Port}").ToArray()
                : new[] { $"http://localhost:{Port}" };

            return(new WebHostBuilder()
                   .UseKestrel()
                   .ConfigureServices(services =>
            {
                services.AddRouting();
                ConfigureServices?.Invoke(services);
            })
                   .Configure(app =>
            {
                if (!string.IsNullOrWhiteSpace(_publicRoot) && Directory.Exists(_publicRoot))
                {
                    var fullPublicPath = Path.GetFullPath(_publicRoot);
                    app.UseFileServer(new FileServerOptions
                    {
                        FileProvider = new PhysicalFileProvider(fullPublicPath)
                    });
                    Console.WriteLine($"Public files directory: {fullPublicPath}");
                }

                if (_useWebSockets)
                {
                    app.UseWebSockets();
                }
                app.UseRouter(routeBuilder =>
                {
                    foreach (var route in _routes)
                    {
                        route(routeBuilder);
                    }
                    _routes.Clear();
                });
                ConfigureApplication?.Invoke(app);
            })
                   .UseUrls(urls)
                   .Build());
        }
Example #5
0
        private void Build(IReadOnlyCollection <string> hostnames)
        {
            if (_host != default)
            {
                throw new RedHttpServerException("The server is already running");
            }
            Initialize();
            var urls = hostnames.Count != 0
                ? hostnames.Select(url => $"http://{url}:{Port}").ToArray()
                : new [] { $"http://localhost:{Port}" };

            _host = new WebHostBuilder()
                    .UseKestrel()
                    .ConfigureServices(services =>
            {
                services.AddRouting();
                ConfigureServices?.Invoke(services);
            })
                    .Configure(app =>
            {
                if (!string.IsNullOrWhiteSpace(_publicRoot) && Directory.Exists(_publicRoot))
                {
                    app.UseFileServer(new FileServerOptions {
                        FileProvider = new PhysicalFileProvider(Path.GetFullPath(_publicRoot))
                    });
                }
                if (_wsHandlers.Any())
                {
                    app.UseWebSockets();
                }
                app.UseRouter(SetRoutes);
                ConfigureApplication?.Invoke(app);
            })
                    .UseUrls(urls)
                    .Build();
        }
Example #6
0
 private void BConfigureClick(object sender, EventArgs e)
 {
     bConfigure.Enabled = false;
       ConfigureApplication appConfig = new ConfigureApplication(_controller);
       appConfig.Disposed += delegate { bConfigure.Enabled = true; };
       DisplayDialog(appConfig, false);
 }
Example #7
0
        private void AddNewApplicationToolStripMenuItemClick(object sender, EventArgs e)
        {
            ConfigureApplication appConfig = new ConfigureApplication(Controller.Settings, Controller);

            Controller.DisplayDialog(appConfig, false);
        }