Zum Hauptinhalt springen
ProdukteDesktop-WerkzeugeTASTECADZeichnungsprüfungTASTEFILESDateiverwaltungTASTEFTPDateiübertragungTASTESSHRemote-ArbeitsbereichTASTEZIPKomprimieren und EntpackenTASTEWINMDateiverwaltungEntwicklerwerkzeugeTASTECODEIntegrierte Entwicklungsumgebung für RustTASTESTUDIOIntegrierte Entwicklungs- und TestumgebungTASTEETLDatenintegration (ETL)ServerTASTEREMOTERemote-Desktop-ServerTASTEGEOGeodatenserverTASTEMAILE-Mail-ArbeitsbereichInvestierenTASTESTOCKDesktop-App für automatischen AktienhandelErste SchritteDownloadsDokumentationKaufenAlle Produkte
Marktplatz
Neuigkeiten
TechnikNeuigkeitenEntwickler-News von heuteEntwicklerdokuProgrammiersprachenRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWeb-Frontend-FrameworksNext.jsReactVue.js · NuxtSvelteKitAngularServer-FrameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressApp- & Desktop-FrameworksTauriFlutterReact NativeElectronAlgorithmenAlgorithmus-GrundlagenKernalgorithmenFortgeschrittene AlgorithmenAlgorithmen für die Praxis
CommunityProjekteEntwicklungslogsPromptsProbleme mit KI-ToolsShowcaseCommunity-Leitfaden
ZusammenarbeitWissenstransferWebsite-AufbauDesktop-App-AufbauRelease- und ZahlungspipelineVertriebspartnerKontakt
DiensteRemote-DesktopIndividuelle Installationspakete
TASTEDEV
Produkte

Desktop-Werkzeuge

TASTECADKomplexe Zeichnungen, mühelos geöffnetTASTEFILESNur die Dateien, die zählen – in BestzeitTASTEFTPDer aufgeräumteste Weg für Ihre DateienTASTESSHDie stärkere Verbindung zu Ihren ServernTASTEZIPSchneller packen, sicherer entpackenTASTEWINMEin tastaturorientierter Dateimanager mit zwei Fenstern

Entwicklerwerkzeuge

TASTECODERust-Apps bearbeiten, bauen, debuggen und testen – alles in einem FensterTASTESTUDIOVom Bearbeiten bis zu Remote-Tests und freigegebenen KI-KorrekturenTASTEETLDaten bewegen, die Werte im Blick

Server

TASTEREMOTEEin Remote-Desktop auf Ihrem eigenen ServerTASTEGEOEin GeoServer-kompatibler Geodatenserver, neu aufgebaut in RustTASTEMAILIhre E-Mail wieder in Ihrer Hand

Investieren

TASTESTOCKAutomatischer Aktienhandel nach Ihren Regeln: wann und was

Erste Schritte

DownloadsNeueste Versionen aller ProdukteDokuSo nutzen Sie jedes ProduktKaufenAbos und DauerlizenzenAlle ProdukteAlle Produkte im Überblick
Alle Produkte
MarktplatzNeuigkeiten
Technik

Neuigkeiten

Entwickler-News von heuteOffizielle Meldungen zu Sprachen, Frameworks, GitHub und KIEntwicklerdokuAnleitungen zu Sprachen, Frameworks und Algorithmen

Programmiersprachen

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Web-Frontend-FrameworksNext.jsReactVue.js · NuxtSvelteKitAngular
Server-FrameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
App- & Desktop-FrameworksTauriFlutterReact NativeElectron

Algorithmen

Algorithmus-GrundlagenKomplexitätsanalyse · Sortieren · Suchen · Grundlegende Datenstrukturen · Bäume und HeapsKernalgorithmenGraphtraversierung · Kürzeste Wege und minimale Spannbäume · Dynamische Programmierung · Greedy-Algorithmen · Teile und herrsche · BacktrackingFortgeschrittene AlgorithmenZeichenkettenalgorithmen · Mathematik und Zahlentheorie · Bitmanipulation · Segmentbäume · Union-FindAlgorithmen für die PraxisStrategie für Coding-Interviews · LRU-Cache · Rate Limiting · Konsistentes Hashing
Alle Entwicklungsdokumente
Community
ProjekteEntwickler und Projekte entdeckenEntwicklungslogsEntscheidungen und ErkenntnissePromptsWiederverwendbare AnweisungenProbleme mit KI-ToolsProbleme und Workarounds für Claude, Codex, GeminiShowcaseFertige ErgebnisseCommunity-LeitfadenWie wir offen entwickeln
Zusammenarbeit
WissenstransferNative Apps mit Rust und eguiWebsite-Aufbau10 Sprachen, Konten, Dokumentation und DownloadsDesktop-App-AufbauRust und egui, ohne WebViewRelease- und ZahlungspipelineSignatur, MSI, deb, rpm, AppImage, PrüfsummenVertriebspartnerEmpfehlen und 30 % erhaltenKontaktEntwicklung, Partnerschaft, Investition
Dienste
Remote-DesktopIhren Computer im Browser erreichenIndividuelle InstallationspaketeNur nötige Funktionen, Einstellungen vorab
Kaufen
DE
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Anmelden
Anmelden
TASTEDEV

Von kleinen Werkzeugen zu besserer Entwicklung.

support@tastedev.netTASTEDEV unterstützen
ProdukteProduktübersichtKaufenDokuDownloadsMarktplatzSupport
CommunityProjekteEntwicklungslogsPromptsProbleme mit KI-ToolsShowcase
RichtlinienÜber unsDatenschutzerklärungNutzungsbedingungenAbo-BedingungenRückerstattungCommunity-Richtlinien
KontoAnmeldenRegistrieren
Besucher
Heute
Gestern
Aufrufe gesamt
Firma
GXSOFT
Vertretungsberechtigt
CHOI YOUNG GU
Handelsregisternummer
853-44-00368
Anschrift
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Telefon
+82-10-4404-1523
E-Mail
whitecalvin@tastedev.net
Datenschutzbeauftragter
CHOI YOUNG GU

© 2026 TASTEDEVProduktinformationen basieren auf verifizierten Entwicklungsquellen.Veröffentlicht · wird verbessert

ASP.NET Core-Dokumentation
ASP.NET Core
Getting Started with ASP.NET CoreProject Structure and ConfigurationCore ConceptsData, Validation and AuthenticationTestingDeployment
Diskussionen

ASP.NET Core-Anleitung · 3/6

Core Concepts

Dieses Kapitel ist vorerst nur auf Englisch verfügbar.

ASP.NET Core is built from a few ideas that fit together: a host that runs the app, a middleware pipeline that every request passes through, a dependency injection container, endpoints written as minimal APIs or controllers, and configuration and logging shared by all of them.

Hosting and the middleware pipeline

WebApplication.CreateBuilder creates a host with Kestrel, configuration, logging and DI. After Build(), each Use... call adds a middleware component. A request flows through them in the order they were added; each can act before and after calling the next one, or end the request early.

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddProblemDetails();

var app = builder.Build();

app.UseExceptionHandler();      // first: catches errors from everything after it
app.UseHttpsRedirection();

app.Use(async (context, next) =>
{
    var watch = System.Diagnostics.Stopwatch.StartNew();
    await next(context);        // run the rest of the pipeline
    app.Logger.LogInformation("{Path} took {Ms} ms", context.Request.Path, watch.ElapsedMilliseconds);
});

app.UseAuthentication();
app.UseAuthorization();

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

Order matters: the exception handler comes first so it wraps everything, and authentication must run before authorization. Endpoints (Map...) run at the end of the pipeline.

Dependency injection

Services are registered on builder.Services with one of three lifetimes:

LifetimeOne instance perTypical use
AddSingletonapplicationcaches, clocks, stateless helpers
AddScopedHTTP requestDbContext, unit-of-work services
AddTransientresolutionlightweight stateless services
builder.Services.AddSingleton(TimeProvider.System);
builder.Services.AddScoped<TodoService>();

The framework injects services wherever it creates objects: minimal API handler parameters, controller constructors and other services. Do not inject a scoped service into a singleton; in Development the container detects this and throws.

Minimal APIs and controllers

Both styles share routing, DI and middleware. Minimal APIs map lambdas or methods directly. TypedResults and Results<...> make every possible response visible in the signature and in OpenAPI:

using Microsoft.AspNetCore.Http.HttpResults;

var todos = app.MapGroup("/todos");

todos.MapGet("/{id:int}", Results<Ok<Todo>, NotFound> (int id, TodoService service) =>
    service.Find(id) is { } todo ? TypedResults.Ok(todo) : TypedResults.NotFound());

todos.MapPost("/", (Todo todo, TodoService service) =>
{
    service.Add(todo);
    return TypedResults.Created($"/todos/{todo.Id}", todo);
});
Fragen zu diesem Kapitel?
Vorheriges KapitelProject Structure and ConfigurationNächstes KapitelData, Validation and Authentication

Controllers group actions in classes and describe routes with attributes:

using Microsoft.AspNetCore.Mvc;

[ApiController]
[Route("api/[controller]")]
public class TodosController(TodoService service) : ControllerBase
{
    [HttpGet("{id:int}")]
    public ActionResult<Todo> Get(int id)
    {
        var todo = service.Find(id);
        if (todo is null) return NotFound();
        return todo;
    }
}

// Program.cs: builder.Services.AddControllers(); ... app.MapControllers();

Minimal APIs are the default for new APIs: less ceremony and very good performance. Controllers suit teams that like MVC conventions, filters and attribute-based model binding, and they are the basis of MVC apps with views.

Routing and binding

Route templates hold parameters and constraints such as {id:int}, {slug} and {page?}. Handler parameters are bound automatically: simple types from route values and the query string, complex types from the JSON body, registered services from DI, and special types such as HttpContext, HttpRequest and CancellationToken. Attributes like [FromQuery], [FromHeader] and [FromServices] (namespace Microsoft.AspNetCore.Mvc) make the source explicit.

// GET /posts/hello-world?page=2
app.MapGet("/posts/{slug}", (string slug, int? page, HttpRequest request) =>
    $"{slug}, page {page ?? 1}, agent {request.Headers.UserAgent}");

Configuration and options

Bind a configuration section to a class and inject it with the options pattern:

using Microsoft.Extensions.Options;

builder.Services.Configure<TodoOptions>(builder.Configuration.GetSection("Todo"));

app.MapGet("/settings", (IOptions<TodoOptions> options) => options.Value.PageSize);

public class TodoOptions
{
    public int PageSize { get; set; } = 20;
}

IOptionsSnapshot<T> re-reads values per request and IOptionsMonitor<T> reports changes. AddOptions<T>().BindConfiguration("Todo").ValidateDataAnnotations().ValidateOnStart() fails fast at startup when settings are invalid.

Logging

public class TodoService(ILogger<TodoService> logger)
{
    public void Add(Todo todo)
    {
        logger.LogInformation("Added todo {TodoId}", todo.Id);
    }
}

ILogger<T> is available everywhere through DI. Use message templates with named placeholders instead of string interpolation so providers can store TodoId as a structured field. Minimum levels per category come from the Logging:LogLevel configuration section.

Summary

  • Middleware runs in registration order; endpoints sit at the end of the pipeline.
  • DI has singleton, scoped and transient lifetimes; the framework injects services for you.
  • Minimal APIs and controllers are two styles on the same foundation.
  • Options classes give typed configuration, and ILogger<T> gives structured logs.

0 Kommentare

Top-KommentareNeueste zuerst

Anmelden · Melde dich an, um einen Kommentar zu schreiben.