using Microsoft.AspNet.Builder; using Microsoft.AspNet.Hosting; using Microsoft.Extensions.DependencyInjection; using HeuristicLab.Clients.Hive.WebJobManager.Services; using Microsoft.Extensions.Configuration; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.PluginInfrastructure; using System; namespace HeuristicLab.Clients.Hive.WebJobManager { public class Startup { public IHostingEnvironment hostingEnvironment { get; set; } public Startup(IHostingEnvironment hostingEnvironment) { var builder = new ConfigurationBuilder() .AddJsonFile("conf.json") .AddEnvironmentVariables(); var config = builder.Build(); ApplicationManager.InitializeForWeb(); ContentManager.Initialize(new PersistenceContentManager()); //Console.WriteLine(""+ config.Get("configuration")); this.hostingEnvironment = hostingEnvironment; } public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddCaching(); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(30); options.CookieName = ".HiveWJM"; }); services.AddSingleton(); services.AddSignalR(); } public void Configure(IApplicationBuilder app) { if (hostingEnvironment.IsDevelopment()) app.UseDeveloperExceptionPage(); app.UseIISPlatformHandler(); app.UseSession(); app.UseStaticFiles(); app.UseSignalR(); app.UseStatusCodePages(); app.UseMvcWithDefaultRoute(); } // Entry point for the application. public static void Main(string[] args) => WebApplication.Run(args); } }