.NET Core (now part of .NET 5+ unified platform) is Microsoft’s modern, fast, cross-platform, and open-source framework for building all kinds of applications — from web apps and APIs to console apps and cloud-native microservices.
This article explains .NET Core in the simplest possible way, perfect for beginners who want to understand what .NET Core is, how it works, and how a real ASP.NET Core project is structured.
1. What is .NET Core?
.NET Core is Microsoft’s next-generation application development framework, built to overcome the limitations of the old .NET Framework.
Why was .NET Core created?
The old .NET Framework could run only on Windows, was heavy, and was not suitable for cloud, containers, and modern architecture.
.NET Core solves all of these issues.
Key Features of .NET Core
1. Cross-Platform
You can develop and run apps on:
You can host apps on IIS, Apache, Nginx, Kestrel, Docker, or the cloud.
2. Open Source
3. High Performance
Perfect for APIs, enterprise apps, and large-scale cloud systems.
4. Lightweight & Modular
You install only what you need using NuGet packages, which makes applications fast and optimized.
5. Built-in Dependency Injection
Dependency Injection (DI) is built into the framework — no need for third-party libraries.
DI makes apps:
Cleaner
Easier to test
More modular
6. Regular Updates
Microsoft releases new versions every year, including LTS (Long-Term Support) versions for stability.
2. ASP.NET vs ASP.NET Core — What’s the Difference?
ASP.NET Core is a complete redesign of ASP.NET — not just a small upgrade.
| Feature | ASP.NET (Old) | ASP.NET Core (New) |
|---|
| Platform | Windows only | Windows, Linux, macOS |
| Performance | Average | Very fast (up to 4x) |
| Architecture | Monolithic | Modular & Lightweight |
| Hosting | IIS only | IIS, Kestrel, Nginx, Apache, Self-host |
| Framework | .NET Framework only | .NET Core & .NET Framework |
| Project Types | MVC, WebForms, Web API | Unified MVC + Web API |
| Latest Version | 4.8.1 | .NET 10 (latest) |
3. Understanding .NET Core Project Structure
When you create a new ASP.NET Core project, you get several important files and folders. Each plays a special role.
3.1 Program.cs
This is the entry point of your application.
What happens here?
Creates and configures the web host
Registers services (Database, Logging, Authentication)
Defines the middleware pipeline
Maps controllers/endpoints
Think of Program.cs as the “main switchboard” that controls your entire app.
3.2 wwwroot Folder
Everything inside this folder is public.
Used for:
CSS files
JavaScript
Images
Bootstrap files
A browser can directly access these files using URLs.
wwwroot = Your public website folder.
3.3 Controllers Folder
Controllers:
Example actions:
GET → Read data
POST → Create data
PUT → Update data
DELETE → Remove data
Controllers are like the reception desk of your app.
3.4 appsettings.json
This is your configuration file.
Used for:
You can also have:
appsettings.json is the “control panel” of your project.
3.5 Other Common Folders
Services
Contains business logic.
Data
Contains:
DbContext
Migrations
Entities
Repositories
Handles database CRUD operations.
DTOs
Used to transfer data safely.
These folders are like the “kitchen and back office.”
They do all the behind-the-scenes work.
4. What is Middleware?
Middleware is the heart of ASP.NET Core.
It is a chain of components that process every request and response.
How Middleware Works
Request → Middleware 1 → Middleware 2 → Middleware 3 → Controller → Response → Back through same middlewares
Key Points About Middleware
Runs one-by-one in the order you configure.
Can modify request or response.
Can stop the request early (called short-circuiting).
Used for Logging, Authentication, Routing, Error Handling, etc.
Understanding the Complete Request Pipeline
Let’s break down each stage in the simplest way.
1) Request
When the user sends a request:
Method: GET / POST / PUT / DELETE
URL: /api/products/5
Headers: Auth token, content type
Body: JSON data (for POST/PUT)
2) Logging Middleware
Tracks
Useful for
Debugging
Performance monitoring
Auditing
3) Routing
Matches URL → Correct controller action.
Without routing, the application does not know where to send a request.
4) Authentication
Authentication answers:
“Who are you?”
Examples
If invalid → Later returns 401 Unauthorized
5) Authorization
Authorization answers:
“Are you allowed to do this?”
Example
Admin-only routes
Checking user roles
Checking user claims
If not allowed → 403 Forbidden
6) Controller Execution
Here, the actual processing happens:
7) Response
Response goes back through the pipeline and finally returns:
Why Middleware Order Matters
Routing should come before authentication
Authentication must come before authorization
Static files should be before MVC
Error handling needs to be at the top
Incorrect order → Errors like:
When Things Go Wrong — Quick Fix Guide
401 — Unauthorized
Problem: No identity.
Fix: Check token/cookie + authentication config
403 — Forbidden
Problem: User is known but not allowed.
Fix: Add required roles/claims or change policy
404 — Not Found
Problem: Route not matched.
Fix: Check controller routes and middleware order
Pipeline issues
If things randomly break →
Fix: Ensure correct order:
UseRouting()
UseAuthentication()
UseAuthorization()
MapControllers()
Final Summary
Here is everything in one simple view:
.NET Core = Fast + Cross-platform + Open-source
ASP.NET Core = Modern web framework built on .NET Core
A project contains a Program.cs, wwwroot, Controllers, and appsettings.json
Middleware = Request processing pipeline
Authentication = Who are you?
Authorization = Are you allowed?
Controllers = Your business logic entry points