https://www.cnblogs.com/lonelyxmas/p/10934388.html

net core 2.x MVC配置

        public void ConfigureServices(IServiceCollection services)
{
services.addMvc();
}
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env,IConfiguration configurarion,IWelcome welcome)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
} app.UseRouting();
app.UseStaticFiles(); app.UseMvc(routs =>
{
routs.MapRoute("default", "{controller=Home}/{action=Index}/{id?}");
});
}

net core 3.x MVC配置

        public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
}
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env,IConfiguration configurarion,IWelcome welcome)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
} app.UseRouting();
app.UseStaticFiles(); app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
});
}
05-08 08:06