.Net Core 学习新建Core MVC 项目
一、新建空的Core web项目

二、在Startup文件中添加如下配置
1. 在ConfigureServices 方法中添加 services.AddMvc();MVC服务
2. app.UseMvc(routes =>
{
routes.MapRoute(name: "default", template: "{Controller=Home}/{action=Index}/{id?}");
});在Configure方法添加路由


三、添加Controllers文件夹

1. 添加一个HomeControler.cs类
2. 添加代码

3. 添加视图


浙公网安备 33010602011771号