Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Startup.cs @ 13848

Last change on this file since 13848 was 13848, checked in by jlodewyc, 9 years ago

#2582 Hive finish, start OKB

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