99using Microsoft . AspNetCore . Http ;
1010using Microsoft . Extensions . Configuration ;
1111using Microsoft . Extensions . DependencyInjection ;
12+ using Microsoft . Extensions . Hosting ;
1213using Microsoft . Extensions . Logging ;
1314using Newtonsoft . Json ;
1415using Newtonsoft . Json . Serialization ;
@@ -18,7 +19,7 @@ namespace ReactDemo
1819{
1920 public class Startup
2021 {
21- public Startup ( IHostingEnvironment env )
22+ public Startup ( IWebHostEnvironment env )
2223 {
2324 var builder = new ConfigurationBuilder ( )
2425 . SetBasePath ( env . ContentRootPath )
@@ -43,11 +44,8 @@ public void ConfigureServices(IServiceCollection services)
4344 }
4445
4546 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
46- public void Configure ( IApplicationBuilder app , IHostingEnvironment env , ILoggerFactory loggerFactory )
47+ public void Configure ( IApplicationBuilder app , IWebHostEnvironment env , ILoggerFactory loggerFactory )
4748 {
48- loggerFactory . AddConsole ( Configuration . GetSection ( "Logging" ) ) ;
49- loggerFactory . AddDebug ( ) ;
50-
5149 if ( env . IsDevelopment ( ) )
5250 {
5351 app . UseDeveloperExceptionPage ( ) ;
@@ -85,11 +83,11 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
8583
8684 app . UseStaticFiles ( ) ;
8785
88- app . UseMvc ( routes =>
86+ app . UseRouting ( ) ;
87+
88+ app . UseEndpoints ( endpoints =>
8989 {
90- routes . MapRoute (
91- name : "default" ,
92- template : "{controller=Home}/{action=Index}/{id?}" ) ;
90+ endpoints . MapControllerRoute ( "default" , "{controller=Home}/{action=Index}/{id?}" ) ;
9391 } ) ;
9492 }
9593 }
0 commit comments