Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true
                });
            }
            else
            {
                //app.Use(async (context, next) =>
                //{
                //    if (context.Request.IsHttps)
                //    {
                //        await next();
                //    }
                //    //else //if(bool.Parse(Configuration["Production:UseAlwaysHTTPS"]))
                //    //{
                //    //    var toHttps = "https://" + context.Request.Host + context.Request.Path;
                //    //    context.Response.Redirect(toHttps);
                //    //}
                //});

                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot", "images")),
                RequestPath = new PathString("/images")
            });

            app.UseAuthentication();

            AutoMapperConfiguration.Configure(Configuration);

            app.UseAntiforgeryToken();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new { controller = "Home", action = "Index" });
            });

            StorageInitializer.Initialize(Configuration);
            DocumentDBInitializer.Initialize(Configuration);
            AzureSearchInitializer.Initialize(Configuration);
        }
Esempio n. 2
0
            void Awake()
            {
                resources = new Dictionary <ResourceType, float>();

                if (initializer != null)
                {
                    initializer.Initialize(this);
                }
            }
Esempio n. 3
0
 static Program()
 {
     StorageInitializer.Initialize(ConnectionString);
 }