
ASP.NET Core Request Lifecycle
Request pipeline, middleware pipeline, filters, action results, model binding
1What is the main role of the request pipeline in ASP.NET Core?
What is the main role of the request pipeline in ASP.NET Core?
Câu trả lời
The request pipeline sequentially processes each HTTP request through middlewares configured in Program.cs. Each middleware can inspect, modify, or short-circuit the request before passing it to the next one. This chain-of-responsibility pattern allows separation of concerns (authentication, logging, compression, etc.) and modular composition of request processing.
2What is the importance of middleware order in the ASP.NET Core pipeline?
What is the importance of middleware order in the ASP.NET Core pipeline?
Câu trả lời
Middleware order is critical because requests are processed top-to-bottom, then responses travel back bottom-to-top. Placing authentication middleware after routing will cause security issues as endpoints will be exposed without verification. Typical order is: Exception Handling → HTTPS Redirection → Static Files → Routing → CORS → Authentication → Authorization → Endpoints.
3How can a middleware short-circuit the request pipeline?
How can a middleware short-circuit the request pipeline?
Câu trả lời
A middleware can short-circuit by not passing the request to the next middleware via next(). This is useful for authentication middlewares returning 401 Unauthorized, serving static files without invoking routing, or implementing caching that returns cached responses without executing business logic. Short-circuiting improves performance by avoiding unnecessary middleware execution.
What are the main sources for model binding in ASP.NET Core?
What is the difference between IActionResult and ActionResult<T>?
+17 câu hỏi phỏng vấn
Các chủ đề phỏng vấn .NET khác
C# Basics
LINQ & Delegates
C# Language Essentials
ASP.NET Core Fundamentals
Configuration & Settings
Application Lifecycle
Dependency Injection
Entity Framework Core
Minimal APIs
Web API Development
Async in ASP.NET Core
Authentication & Authorization
HttpClient & Networking
JSON Serialization
Entity Framework Core Advanced
C# Advanced Features
Clean Architecture
Logging, Monitoring & Observability
Unit Testing & xUnit
Integration Testing
Docker & Containerization
NuGet Package Management
Memory Management & GC
Reactive Programming
Async/await & Patterns
.NET Design Patterns
Performance Optimization
Security & Best Practices
SignalR & Real-time
Microservices Architecture
Nắm vững .NET cho lần phỏng vấn tiếp theo
Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.
Bắt đầu miễn phí