예제 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        // Note: Configures Services
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider sp)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseAuthentication();
            app.UseCors(builder =>
                        builder.WithOrigins("http://www.jobyjobs.com", "http://joby.ori-pc.com")
                        .AllowAnyOrigin()   //Todo. find a better solution.
                        .AllowAnyHeader()
                        .AllowAnyMethod()); //Note: allow CORS;

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

            //user code here:
            //Initializes cache.
            SiteExtensions.Initialize(Configuration);
            sp.GetService <ICacheManager>().Initialize(sp.GetService <IBLCacheSource>());
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        // Note: Configures Services
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider sp)
        {
            m_logger.Error("Test: Startup.Configure() : Start");
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true
                });
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            if (env.IsDevelopment())
            {
                //test: read raw request.
                //app.Use(next => context => { context.Request.EnableRewind(); return next(context); });
            }
            app.UseAuthentication();
            app.UseCors(builder =>
                        builder.WithOrigins("http://www.jobyjobs.com", "http://joby.ori-pc.com")
                        .AllowAnyOrigin()   //Todo. find a better solution.
                        .AllowAnyHeader()
                        .AllowAnyMethod()); //Note: allow CORS;
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new { controller = "Home", action = "Index" });
            });
            app.UseSignalR(routes =>
            {
                routes.MapHub <ChatHub>("chat");
                routes.MapHub <NotificationsHub>("notifications");
            });

            //user code here:
            //Initializes cache.
            SiteExtensions.Initialize(Configuration);
            sp.GetService <ICacheManager>().Initialize(sp.GetService <IBLCacheSource>());
            m_logger.Error("Test: Startup.Configure() : End");
        }