From ee80c6ff969b5b4cfc3d1292f15928fc8bd2d667 Mon Sep 17 00:00:00 2001 From: transtrike Date: Thu, 10 Dec 2020 13:54:23 +0200 Subject: Replaced ASP.NET Core MVC with Blazor --- Web/Startup.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Web/Startup.cs') diff --git a/Web/Startup.cs b/Web/Startup.cs index 51a6797..b72eb44 100644 --- a/Web/Startup.cs +++ b/Web/Startup.cs @@ -3,11 +3,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Web.Data; namespace Web { @@ -21,9 +23,12 @@ namespace Web public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { - services.AddControllersWithViews(); + services.AddRazorPages(); + services.AddServerSideBlazor(); + services.AddSingleton(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -35,22 +40,20 @@ namespace Web } else { - app.UseExceptionHandler("/Home/Error"); + app.UseExceptionHandler("/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.UseRouting(); - app.UseAuthorization(); - app.UseEndpoints(endpoints => { - endpoints.MapControllerRoute( - name: "default", - pattern: "{controller=Home}/{action=Index}/{id?}"); + endpoints.MapBlazorHub(); + endpoints.MapFallbackToPage("/_Host"); }); } } -- cgit v1.2.3