HJ212 and Documents
This commit is contained in:
@@ -1,23 +1,37 @@
|
||||
// AnyType - ASP.NET Core Web 应用入口
|
||||
// 任何类型的数据都可以处理的 Web 应用示例
|
||||
|
||||
// 创建 Web 应用构建器
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
// 添加服务到容器
|
||||
// 添加控制器和视图支持
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
// 构建应用
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
// 配置 HTTP 请求管道
|
||||
// 如果不是开发环境,使用异常处理中间件
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
}
|
||||
|
||||
// 启用静态文件服务
|
||||
app.UseStaticFiles();
|
||||
|
||||
// 启用路由
|
||||
app.UseRouting();
|
||||
|
||||
// 启用授权
|
||||
app.UseAuthorization();
|
||||
|
||||
// 映射控制器路由
|
||||
// 默认路由模式:{controller=Home}/{action=Index}/{id?}
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
// 运行应用
|
||||
app.Run();
|
||||
|
||||
Reference in New Issue
Block a user