1
1
using System ;
2
- using System . Security . Claims ;
3
2
using FrontEnd . Data ;
4
3
using FrontEnd . HealthChecks ;
5
4
using FrontEnd . Services ;
6
5
using Microsoft . AspNetCore . Builder ;
7
6
using Microsoft . AspNetCore . Hosting ;
8
7
using Microsoft . AspNetCore . Mvc ;
9
- using Microsoft . AspNetCore . Routing ;
10
8
using Microsoft . Extensions . Configuration ;
11
9
using Microsoft . Extensions . DependencyInjection ;
10
+ using Microsoft . Extensions . Hosting ;
12
11
13
12
namespace FrontEnd
14
13
{
@@ -39,15 +38,15 @@ public void ConfigureServices(IServiceCollection services)
39
38
client . BaseAddress = new Uri ( Configuration [ "serviceUrl" ] ) ;
40
39
} ) ;
41
40
42
- services . AddMvc ( options =>
41
+ services . AddRazorPages ( options =>
43
42
{
44
- options . Filters . AddService < RequireLoginFilter > ( ) ;
43
+ options . Conventions . AuthorizeFolder ( "/Admin" , "Admin" ) ;
45
44
} )
46
- . AddRazorPagesOptions ( options =>
45
+ . AddMvcOptions ( options =>
47
46
{
48
- options . Conventions . AuthorizeFolder ( "/Admin" , "Admin" ) ;
47
+ options . Filters . AddService < RequireLoginFilter > ( ) ;
49
48
} )
50
- . SetCompatibilityVersion ( CompatibilityVersion . Version_2_2 ) ;
49
+ . SetCompatibilityVersion ( CompatibilityVersion . Version_3_0 ) ;
51
50
52
51
services . AddHealthChecks ( )
53
52
. AddCheck < BackendHealthCheck > ( "backend" )
@@ -56,7 +55,7 @@ public void ConfigureServices(IServiceCollection services)
56
55
services . AddSingleton < IAdminService , AdminService > ( ) ;
57
56
}
58
57
59
- public void Configure ( IApplicationBuilder app , IHostingEnvironment env )
58
+ public void Configure ( IApplicationBuilder app , IWebHostEnvironment env )
60
59
{
61
60
if ( env . IsDevelopment ( ) )
62
61
{
@@ -69,21 +68,20 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
69
68
app . UseHsts ( ) ;
70
69
}
71
70
72
- app . UseStatusCodePagesWithReExecute ( "/Status/{0}" ) ;
71
+ // app.UseStatusCodePagesWithReExecute("/Status/{0}");
73
72
74
73
app . UseHttpsRedirection ( ) ;
75
-
76
74
app . UseStaticFiles ( ) ;
77
75
78
- app . UseAuthentication ( ) ;
76
+ app . UseRouting ( ) ;
79
77
80
- app . UseHealthChecks ( "/health" ) ;
78
+ app . UseAuthentication ( ) ;
79
+ app . UseAuthorization ( ) ;
81
80
82
- app . UseMvc ( routes =>
81
+ app . UseEndpoints ( endpoints =>
83
82
{
84
- routes . MapRoute (
85
- name : "default" ,
86
- template : "{controller=Home}/{action=Index}/{id?}" ) ;
83
+ endpoints . MapRazorPages ( ) ;
84
+ endpoints . MapHealthChecks ( "/health" ) ;
87
85
} ) ;
88
86
}
89
87
}
0 commit comments