// 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.UseDatabaseErrorPage(); app.UseStatusCodePages(async context => { context.HttpContext.Response.ContentType = "text/plain"; await context.HttpContext.Response.WriteAsync( "Status code page, status code: " + context.HttpContext.Response.StatusCode + " " + context.HttpContext.Response.ContentType); }); app.UseStatusCodePagesWithRedirects("/error/{0}"); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseSession(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); //Required to proxy when deployed to apache or nginx app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); app.UseCors(opt => opt.AllowAnyMethod() .AllowAnyHeader() .AllowAnyOrigin() .AllowCredentials()); app.UseMvc(); ConfigureServiceExtension.UseConfiguration(app); }
// 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(); } else { app.UseHsts(); } ConfigureServiceExtension.UseConfiguration(app); app.UseStatusCodePages(async context => { context.HttpContext.Response.ContentType = "application/json"; await context.HttpContext.Response.WriteAsync( "Status code page, status code: " + context.HttpContext.Response.StatusCode); }); app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); app.UseAuthentication(); app.UseCors(opt => opt.AllowAnyMethod() .AllowAnyHeader() .AllowAnyOrigin() .AllowCredentials()); app.UseSignalR(route => { //route.MapHub<ChatHub> ("/chatHub"); route.MapHub <HopeLine.API.Hubs.v2.ChatHub>("/v2/chatHub"); }); app.UseMvc(); }