@@ -18,7 +18,7 @@ namespace ReactDemo
1818{
1919 public class Startup
2020 {
21- public Startup ( IWebHostEnvironment env )
21+ public Startup ( IHostingEnvironment env )
2222 {
2323 var builder = new ConfigurationBuilder ( )
2424 . SetBasePath ( env . ContentRootPath )
@@ -43,9 +43,20 @@ public void ConfigureServices(IServiceCollection services)
4343 }
4444
4545 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
46- public void Configure ( IApplicationBuilder app , IWebHostEnvironment env , ILoggerFactory loggerFactory )
46+ public void Configure ( IApplicationBuilder app , IHostingEnvironment env , ILoggerFactory loggerFactory )
4747 {
48- app . UseDeveloperExceptionPage ( ) ;
48+ loggerFactory . AddConsole ( Configuration . GetSection ( "Logging" ) ) ;
49+ loggerFactory . AddDebug ( ) ;
50+
51+ if ( env . IsDevelopment ( ) )
52+ {
53+ app . UseDeveloperExceptionPage ( ) ;
54+ app . UseBrowserLink ( ) ;
55+ }
56+ else
57+ {
58+ app . UseExceptionHandler ( "/Home/Error" ) ;
59+ }
4960
5061 // Initialise ReactJS.NET. Must be before static files.
5162 app . UseReact ( config =>
@@ -74,11 +85,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF
7485
7586 app . UseStaticFiles ( ) ;
7687
77- app . UseRouting ( ) ;
78-
79- app . UseEndpoints ( endpoints =>
88+ app . UseMvc ( routes =>
8089 {
81- endpoints . MapControllerRoute ( "default" , "{controller=Home}/{action=Index}/{id?}" ) ;
90+ routes . MapRoute (
91+ name : "default" ,
92+ template : "{controller=Home}/{action=Index}/{id?}" ) ;
8293 } ) ;
8394 }
8495 }
0 commit comments