public void Configure( IApplicationBuilder app, IHostingEnvironment env, RazorRen.Generator.Options razorRenOptions ) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); } if ( !string.IsNullOrWhiteSpace(razorRenOptions.OutputPath) && !System.IO.Directory.Exists(System.IO.Path.Combine(env.ContentRootPath, razorRenOptions.OutputPath)) ) { System.IO.Directory.CreateDirectory(System.IO.Path.Combine(env.ContentRootPath, razorRenOptions.OutputPath)); } app.UseWhen( context => { return(!context.Request.Path.StartsWithSegments(new PathString("/admin"))); }, (branch) => { branch.UseDefaultFiles(); branch.UseStaticFiles(); branch.UseStaticFiles( new StaticFileOptions { FileProvider = new CompositeFileProvider( new PhysicalFileProvider(env.WebRootPath), new PhysicalFileProvider(System.IO.Path.Combine(env.ContentRootPath, razorRenOptions.OutputPath)) ) } ); branch.UseRazorRen(); } ); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); }); }
public void Configure( IApplicationBuilder app, IHostingEnvironment env, RazorRen.Generator.Options razorRenOptions ) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } if ( !string.IsNullOrWhiteSpace(razorRenOptions.OutputPath) && !System.IO.Directory.Exists(System.IO.Path.Combine(env.ContentRootPath, razorRenOptions.OutputPath)) ) { System.IO.Directory.CreateDirectory(System.IO.Path.Combine(env.ContentRootPath, razorRenOptions.OutputPath)); } app.UseDefaultFiles(); app.UseStaticFiles(); app.UseStaticFiles( new StaticFileOptions { FileProvider = new CompositeFileProvider( new PhysicalFileProvider(env.WebRootPath), new PhysicalFileProvider(System.IO.Path.Combine(env.ContentRootPath, razorRenOptions.OutputPath)) ) } ); app.UseRazorRen(); app.UseMvc( routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); } ); }