wasAsked.

What is the difference between .NET Core and ASP.NET Core?

Frequently Asked (All Companies) · Role not specified · technical

Published

Year not specified · .NET, ASP.NET Core

Community answers

Posted by wasAsked editorial collection

.NET Core is the cross-platform runtime and framework (now simply called .NET from version 5). ASP.NET Core is the web framework that runs on top of it. .NET Core (now .NET) - The general-purpose platform: runtime (CLR), garbage collector, JIT and AOT compilation, base class libraries, SDK and tools. - Used to build any kind of application: console apps, background worker services, desktop apps (WPF, Windows Forms, MAUI), libraries, Azure Functions, games and web applications. ASP.NET Core - A framework built on .NET for web workloads: - Web APIs (controllers and minimal APIs). - Server-rendered web apps (MVC and Razor Pages). - Interactive web UIs (Blazor). - Real-time communication (SignalR) and gRPC services. - Provides web-specific infrastructure: the Kestrel web server, the middleware pipeline, routing, model binding and validation, authentication and authorization, CORS, rate limiting, output caching, health checks, static files and Problem Details error handling. - Uses the shared .NET hosting model, dependency injection, configuration and logging (which are also available to non-web apps through the generic host). Relationship ASP.NET Core is one of many frameworks in the .NET ecosystem. Every ASP.NET Core application is a .NET application, but not every .NET application uses ASP.NET Core. Project SDK difference - A console or worker app uses Microsoft.NET.Sdk (or Microsoft.NET.Sdk.Worker). - A web app uses Microsoft.NET.Sdk.Web, which references the ASP.NET Core shared framework (Microsoft.AspNetCore.App). Example // .NET console app — no ASP.NET Core Console.WriteLine("Processing files..."); // ASP.NET Core web API var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); var app = builder.Build(); app.MapControllers(); app.Run(); Deployment difference - A .NET console app needs only the .NET runtime. - An ASP.NET Core app needs the ASP.NET Core runtime (which includes the .NET runtime), or is published self-contained or as a container image (mcr.microsoft.com/dotnet/aspnet). Naming note - ".NET Core" referred to versions 1.0–3.1. From version 5 the platform is just ".NET" (.NET 8, .NET 10), but the web framework kept the name ASP.NET Core, and Entity Framework Core kept its name too. Interview summary: ".NET Core (now .NET) is the cross-platform runtime and libraries for all application types; ASP.NET Core is the web framework on top of it for APIs, websites, Blazor, SignalR and gRPC."

Ravindra Wadile · · 0 likes

Sign in to add your answer

Related interview topics