[13689] | 1 | using Microsoft.AspNet.Builder;
|
---|
[13656] | 2 | using Microsoft.AspNet.Hosting;
|
---|
| 3 | using Microsoft.Extensions.DependencyInjection;
|
---|
| 4 | using HeuristicLab.Clients.Hive.WebJobManager.Services;
|
---|
| 5 | using Microsoft.Extensions.Configuration;
|
---|
| 6 | using HeuristicLab.Common;
|
---|
| 7 | using HeuristicLab.Core;
|
---|
[13689] | 8 | using HeuristicLab.PluginInfrastructure;
|
---|
[13739] | 9 | using System;
|
---|
[13656] | 10 |
|
---|
| 11 | namespace HeuristicLab.Clients.Hive.WebJobManager
|
---|
| 12 | {
|
---|
| 13 | public class Startup
|
---|
| 14 | {
|
---|
[13689] | 15 | public IHostingEnvironment hostingEnvironment {
|
---|
| 16 | get; set; }
|
---|
[13656] | 17 | public Startup(IHostingEnvironment hostingEnvironment)
|
---|
| 18 | {
|
---|
| 19 | var builder = new ConfigurationBuilder()
|
---|
| 20 | .AddJsonFile("conf.json")
|
---|
| 21 | .AddEnvironmentVariables();
|
---|
| 22 | var config = builder.Build();
|
---|
[13689] | 23 |
|
---|
| 24 | ApplicationManager.InitializeForWeb();
|
---|
| 25 |
|
---|
| 26 |
|
---|
[13656] | 27 | ContentManager.Initialize(new PersistenceContentManager());
|
---|
| 28 | //Console.WriteLine(""+ config.Get("configuration"));
|
---|
| 29 | this.hostingEnvironment = hostingEnvironment;
|
---|
| 30 | }
|
---|
[13733] | 31 | public void ConfigureServices(IServiceCollection services)
|
---|
[13656] | 32 | {
|
---|
| 33 |
|
---|
| 34 | services.AddMvc();
|
---|
[13739] | 35 |
|
---|
| 36 | services.AddCaching();
|
---|
| 37 | services.AddSession(options => {
|
---|
| 38 | options.IdleTimeout = TimeSpan.FromMinutes(30);
|
---|
| 39 | options.CookieName = ".HiveWJM";
|
---|
| 40 | });
|
---|
[13733] | 41 | services.AddSingleton<IHiveServiceLocator, HiveServiceLocatorWeb>();
|
---|
[13689] | 42 | services.AddSignalR();
|
---|
[13656] | 43 | }
|
---|
| 44 |
|
---|
[13733] | 45 | public void Configure(IApplicationBuilder app)
|
---|
[13656] | 46 | {
|
---|
[13689] | 47 |
|
---|
[13656] | 48 | if (hostingEnvironment.IsDevelopment())
|
---|
| 49 | app.UseDeveloperExceptionPage();
|
---|
| 50 |
|
---|
| 51 | app.UseIISPlatformHandler();
|
---|
[13739] | 52 | app.UseSession();
|
---|
[13656] | 53 | app.UseStaticFiles();
|
---|
[13689] | 54 | app.UseSignalR();
|
---|
[13656] | 55 | app.UseStatusCodePages();
|
---|
[13689] | 56 | app.UseMvcWithDefaultRoute();
|
---|
[13656] | 57 | }
|
---|
| 58 |
|
---|
[13689] | 59 |
|
---|
| 60 |
|
---|
[13656] | 61 | // Entry point for the application.
|
---|
| 62 | public static void Main(string[] args) => WebApplication.Run<Startup>(args);
|
---|
| 63 | }
|
---|
| 64 | }
|
---|