public void Configure(IApplicationBuilder app, IHostingEnvironment env) { List <IApplicationConfigurator> configurators = new List <IApplicationConfigurator>(); foreach (Type type in AssemblyScanner.GetAllTypesOfInterface <IApplicationConfigurator>()) { IApplicationConfigurator configurator = (IApplicationConfigurator)Activator.CreateInstance(type); configurators.Add(configurator); } foreach (IApplicationConfigurator configurator in configurators.OrderBy(c => c.Order)) { configurator.Configure(app, env, SillycoreAppBuilder.Instance.Configuration, app.ApplicationServices); } }
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { var forwardOptions = new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.All, RequireHeaderSymmetry = false }; forwardOptions.KnownNetworks.Clear(); forwardOptions.KnownProxies.Clear(); app.UseForwardedHeaders(forwardOptions); List <IApplicationConfigurator> configurators = new List <IApplicationConfigurator>(); foreach (Type type in AssemblyScanner.GetAllTypesOfInterface <IApplicationConfigurator>()) { IApplicationConfigurator configurator = (IApplicationConfigurator)Activator.CreateInstance(type); configurators.Add(configurator); } foreach (IApplicationConfigurator configurator in configurators.OrderBy(c => c.Order)) { configurator.Configure(app, env, SillycoreAppBuilder.Instance.Configuration, app.ApplicationServices); } app.UseMetricsAllMiddleware(); app.UseMvc(r => { if (SillycoreAppBuilder.Instance.DataStore.Get <bool>(Constants.RedirectRootToSwagger)) { r.MapRoute(name: "Default", template: "", defaults: new { controller = "Help", action = "Index" }); } else { r.MapRoute(name: "Default", template: "", defaults: new { controller = "Home", action = "Index" }); } }); }