55using Microsoft . AspNetCore . DataProtection ;
66using Microsoft . AspNetCore . Diagnostics . HealthChecks ;
77using Microsoft . AspNetCore . Hosting ;
8- using Microsoft . AspNetCore . Mvc ;
98using Microsoft . Extensions . Configuration ;
109using Microsoft . Extensions . DependencyInjection ;
1110using Microsoft . Extensions . Diagnostics . HealthChecks ;
@@ -26,12 +25,8 @@ public Startup(IConfiguration configuration)
2625
2726 public IConfiguration Configuration { get ; }
2827
29- private IHostingEnvironment _hostingEnv ;
30-
31- public Startup ( IHostingEnvironment env )
28+ public Startup ( )
3229 {
33- _hostingEnv = env ;
34-
3530 var localPath = new Uri ( Configuration [ "ASPNETCORE_URLS" ] ) ? . LocalPath ?? "/" ;
3631 Configuration [ "BaseUrl" ] = localPath ;
3732 }
@@ -48,8 +43,6 @@ public void ConfigureServices(IServiceCollection services)
4843 . AddUrlGroup ( new Uri ( Configuration [ "MarketingUrlHC" ] ) , name : "marketingapigw-check" , tags : new string [ ] { "marketingapigw" } )
4944 . AddUrlGroup ( new Uri ( Configuration [ "IdentityUrlHC" ] ) , name : "identityapi-check" , tags : new string [ ] { "identityapi" } ) ;
5045
51- services . AddControllers ( ) ;
52-
5346 services . Configure < AppSettings > ( Configuration ) ;
5447
5548 if ( Configuration . GetValue < string > ( "IsClusterEnv" ) == bool . TrueString )
@@ -62,16 +55,13 @@ public void ConfigureServices(IServiceCollection services)
6255 }
6356
6457 services . AddAntiforgery ( options => options . HeaderName = "X-XSRF-TOKEN" ) ;
65-
66- services . AddMvc ( )
67- . SetCompatibilityVersion ( CompatibilityVersion . Version_3_0 )
58+ services . AddControllers ( )
6859 . AddJsonOptions ( options =>
6960 {
7061 options . JsonSerializerOptions . PropertyNameCaseInsensitive = true ;
7162 } ) ;
7263 }
7364
74-
7565 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
7666 public void Configure ( IApplicationBuilder app , IHostingEnvironment env , ILoggerFactory loggerFactory , IAntiforgery antiforgery )
7767 {
@@ -102,6 +92,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
10292 WebContextSeed . Seed ( app , env , loggerFactory ) ;
10393
10494 var pathBase = Configuration [ "PATH_BASE" ] ;
95+
10596 if ( ! string . IsNullOrEmpty ( pathBase ) )
10697 {
10798 loggerFactory . CreateLogger < Startup > ( ) . LogDebug ( "Using PATH BASE '{pathBase}'" , pathBase ) ;
@@ -127,6 +118,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
127118 app . UseRouting ( ) ;
128119 app . UseEndpoints ( endpoints =>
129120 {
121+ endpoints . MapControllers ( ) ;
130122 endpoints . MapHealthChecks ( "/liveness" , new HealthCheckOptions
131123 {
132124 Predicate = r => r . Name . Contains ( "self" )
0 commit comments