public DefaultApiDescriptionProvider(Microsoft.Extensions.Options.IOptions <Microsoft.AspNetCore.Mvc.MvcOptions> optionsAccessor, Microsoft.AspNetCore.Routing.IInlineConstraintResolver constraintResolver, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider modelMetadataProvider, Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultTypeMapper mapper, Microsoft.Extensions.Options.IOptions <Microsoft.AspNetCore.Routing.RouteOptions> routeOptions)
 {
 }
Example #2
0
        // http://benfoster.io/blog/how-to-configure-kestrel-urls-in-aspnet-core-rc2
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env
                              //, Microsoft.Extensions.Options.IOptions<Dictionary<string, ConnectionString>> cons
                              //, ConfigData.cConnectionStrings cons
                              )
        {
            app.Use(
                delegate(HttpContext context, System.Func <Task> next)
            {
                if (context.Response.Headers.ContainsKey("X-SourceFiles"))
                {
                    context.Response.Headers.Remove("X-SourceFiles");
                }

                return(next.Invoke());
            }
                );


            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                // app.UseBrowserLink();
            }
            else
            {
                app.UseDeveloperExceptionPage();
                // app.UseExceptionHandler("/Home/Error");
            }

            app.UseStatusCodePages();

            app.AddHandlers(typeof(Startup).Assembly);

            /*
             * // this is for modules
             * app.UseWhen(delegate (HttpContext context)
             * {
             *  return ps.Equals(context.Request.Path, StringComparison.InvariantCultureIgnoreCase);
             * }, x => x.UseMiddleware<FooMiddleware>());
             */

            app.UseStaticFiles();
            app.UseFileServer(enableDirectoryBrowsing: false);


            app.UseRouter(
                delegate(Microsoft.AspNetCore.Routing.IRouteBuilder r)
            {
                Microsoft.AspNetCore.Routing.IInlineConstraintResolver requiredService =
                    r.ServiceProvider.GetRequiredService <Microsoft.AspNetCore.Routing.IInlineConstraintResolver>();

                r.Routes.Add(new Microsoft.AspNetCore.Routing.Route(new CoreCMS.Routing.SubdomainRouteHandler(app)
                                                                    , "{controller=Home}/{action=Index}/{id?}"
                                                                    , requiredService));
            }
                );

            // https://blog.elmah.io/improving-security-in-asp-net-mvc-using-custom-headers/
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        } // End Sub Configure