Nguon: Microsoft Learn · .NET 8.0

Kestrel web server trong ASP.NET Core

Nguồn: Kestrel web server in ASP.NET Core

Kestrel là một web server đa nền tảng (cross-platform) cho ASP.NET Core. Kestrel là server được khuyến nghị cho ASP.NET Core và được cấu hình mặc định trong các project template của ASP.NET Core.

Các tính năng của Kestrel bao gồm:

Bắt đầu

Các project template ASP.NET Core sử dụng Kestrel mặc định khi không được hosted với IIS. Trong Program.cs được tạo từ template, phương thức WebApplication.CreateBuilder gọi UseKestrel nội bộ:

csharp
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.MapGet("/", () => "Hello World!");

app.Run();

Để biết thêm về cấu hình WebApplicationWebApplicationBuilder, xem Minimal APIs quick reference.

Hành vi khi đính kèm debugger

Các timeout và rate limit sau đây không được thực thi khi có debugger được đính kèm vào process Kestrel:

Tài nguyên bổ sung