// 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(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); AppContextHelper.Configure(app.ApplicationServices.GetRequiredService <IHttpContextAccessor>()); RunMigrations(app); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseAuthentication(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseSession(); AppContextHelper.Configure(app.ApplicationServices.GetRequiredService <IHttpContextAccessor>()); RunMigrations(app); SeedData(serviceProvider); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { app.UseElmah(); // note: already registered in the ABP AppContextHelper.Configure(app.ApplicationServices.GetRequiredService <IHttpContextAccessor>()); // use NHibernate session per request //app.UseNHibernateSessionPerRequest(); app.UseHangfireServer(); app.UseAbp(options => { options.UseAbpRequestLocalization = false; }); // Initializes ABP framework. // global cors policy app.UseCors(x => x .AllowAnyMethod() .AllowAnyHeader() .SetIsOriginAllowed(origin => true) // allow any origin .AllowCredentials()); // allow credentials app.UseStaticFiles(); app.UseAuthentication(); app.UseAbpRequestLocalization(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "defaultWithArea", pattern: "{area}/{controller=Home}/{action=Index}/{id?}"); endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapHub <AbpCommonHub>("/signalr"); endpoints.MapControllers(); endpoints.MapSignalRHubs(); }); // Enable middleware to serve generated Swagger as a JSON endpoint app.UseSwagger(); // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.) app.UseSwaggerUI(options => { options.SwaggerEndpoint("swagger/v1/swagger.json", "Shesha API V1"); options.IndexStream = () => Assembly.GetExecutingAssembly() .GetManifestResourceStream("Shesha.Web.Host.wwwroot.swagger.ui.index.html"); }); // URL: /swagger app.UseHangfireDashboard(); }
public void Configure(IApplicationBuilder app, IBackgroundJobClient backgroundJobs) { app.UseElmah(); // note: already registered in the ABP AppContextHelper.Configure(app.ApplicationServices.GetRequiredService <IHttpContextAccessor>()); app.UseAbp(options => { options.UseAbpRequestLocalization = false; }); // Initializes ABP framework. //app.UseCors(_defaultCorsPolicyName); // Enable CORS! // global cors policy app.UseCors(x => x .AllowAnyMethod() .AllowAnyHeader() .SetIsOriginAllowed(origin => true) // allow any origin .AllowCredentials()); // allow credentials app.UseStaticFiles(); app.UseAuthentication(); app.UseAbpRequestLocalization(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "defaultWithArea", pattern: "{area}/{controller=Home}/{action=Index}/{id?}"); endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapHub <AbpCommonHub>("/signalr"); endpoints.MapControllers(); endpoints.MapSignalRHubs(); }); // Enable middleware to serve generated Swagger as a JSON endpoint app.UseSwagger(); // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.) app.UseSwaggerUI(options => { options.SwaggerEndpoint("swagger/v1/swagger.json", "Shesha API V1"); // todo: add documents per module with summary about `service:xxx` endpoints //options.SwaggerEndpoint(baseUrl + "swagger/service:Meter/swagger.json", "Meter API"); options.IndexStream = () => Assembly.GetExecutingAssembly() .GetManifestResourceStream("ShaCompanyName.ShaProjectName.Web.Host.wwwroot.swagger.ui.index.html"); }); // URL: /swagger var options = new BackgroundJobServerOptions { //Queues = new[] { "alpha", "beta", "default" } }; app.UseHangfireServer(options); app.UseHangfireDashboard(); }