1
1
using Microsoft . AspNetCore . Builder ;
2
2
using Microsoft . AspNetCore . Hosting ;
3
- using Microsoft . AspNetCore . Mvc ;
4
3
using Microsoft . Extensions . Configuration ;
5
4
using Microsoft . Extensions . DependencyInjection ;
5
+ using Microsoft . Extensions . Hosting ;
6
6
7
7
namespace AWSServerless1
8
8
{
@@ -13,16 +13,16 @@ public Startup(IConfiguration configuration)
13
13
Configuration = configuration ;
14
14
}
15
15
16
- public static IConfiguration Configuration { get ; private set ; }
16
+ public IConfiguration Configuration { get ; }
17
17
18
- // This method gets called by the runtime. Use this method to add services to the container
18
+ // This method gets called by the runtime. Use this method to add services to the container.
19
19
public void ConfigureServices ( IServiceCollection services )
20
20
{
21
- services . AddMvc ( ) . SetCompatibilityVersion ( CompatibilityVersion . Version_2_1 ) ;
21
+ services . AddControllers ( ) ;
22
22
}
23
23
24
- // This method gets called by the runtime. Use this method to configure the HTTP request pipeline
25
- public void Configure ( IApplicationBuilder app , IHostingEnvironment env )
24
+ // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
25
+ public void Configure ( IApplicationBuilder app , IWebHostEnvironment env )
26
26
{
27
27
if ( env . IsDevelopment ( ) )
28
28
{
@@ -33,8 +33,13 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
33
33
app . UseHsts ( ) ;
34
34
}
35
35
36
+ app . UseRouting ( ) ;
36
37
app . UseHttpsRedirection ( ) ;
37
- app . UseMvc ( ) ;
38
+
39
+ app . UseEndpoints ( endpoints =>
40
+ {
41
+ endpoints . MapControllers ( ) ;
42
+ } ) ;
38
43
}
39
44
}
40
45
}
0 commit comments