| 1 | using Microsoft.AspNetCore.Builder; |
| 2 | using Microsoft.AspNetCore.Hosting; |
| 3 | using Microsoft.Extensions.Configuration; |
| 4 | using Microsoft.Extensions.DependencyInjection; |
| 5 | using Microsoft.Extensions.Hosting; |
| 6 | using System; |
| 7 | using System.Collections.Generic; |
| 8 | using System.Linq; |
| 9 | using System.Threading.Tasks; |
| 10 | |
| 11 | namespace CsprojWebApplicationNetCore |
| 12 | { |
| 13 | public class Startup |
| 14 | { |
| 15 | public Startup(IConfiguration configuration) |
| 16 | { |
| 17 | Configuration = configuration; |
| 18 | } |
| 19 | |
| 20 | public IConfiguration Configuration { get; } |
| 21 | |
| 22 | // This method gets called by the runtime. Use this method to add services to the container. |
| 23 | public void ConfigureServices(IServiceCollection services) |
| 24 | { |
| 25 | services.AddRazorPages(); |
| 26 | } |
| 27 | |
| 28 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. |
| 29 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
| 30 | { |
| 31 | if (env.IsDevelopment()) |
| 32 | { |
| 33 | app.UseDeveloperExceptionPage(); |
| 34 | } |
| 35 | else |
| 36 | { |
| 37 | app.UseExceptionHandler("/Error"); |
| 38 | } |
| 39 | |
| 40 | app.UseStaticFiles(); |
| 41 | |
| 42 | app.UseRouting(); |
| 43 | |
| 44 | app.UseAuthorization(); |
| 45 | |
| 46 | app.UseEndpoints(endpoints => |
| 47 | { |
| 48 | endpoints.MapRazorPages(); |
| 49 | }); |
| 50 | } |
| 51 | } |
| 52 | } |