本文へスキップ
製品デスクトップツールTASTECAD図面の確認TASTEFILESファイル管理TASTEFTPファイル転送TASTESSHリモートワークスペースTASTEZIP圧縮と展開TASTEWINMファイル管理開発ツールTASTECODERust 統合開発環境TASTESTUDIO統合開発・テスト環境TASTEETLデータ統合(ETL)サーバーTASTEREMOTEリモートデスクトップサーバーTASTEGEO空間情報サーバーTASTEMAILメールワークスペース投資TASTESTOCK株式自動売買デスクトップアプリはじめるダウンロードドキュメント購入すべての製品
マーケットプレイス
ニュース
技術ニュース今日の開発ニュース開発ドキュメントプログラミング言語RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWebフロントエンド フレームワークNext.jsReactVue.js · NuxtSvelteKitAngularサーバー フレームワークSpring BootDjangoFastAPIASP.NET CoreNestJS · Expressアプリ・デスクトップ フレームワークTauriFlutterReact NativeElectronアルゴリズムアルゴリズムの基礎主要アルゴリズム発展アルゴリズム実務のアルゴリズム
コミュニティプロジェクト開発ログプロンプトAIツールの問題ショーケースコミュニティガイド
協業技術移転ウェブサイト構築デスクトップアプリ構築リリース・決済パイプライン販売パートナーお問い合わせ
サービスリモートデスクトップインストールパッケージのカスタマイズ
TASTEDEV
製品

デスクトップツール

TASTECAD複雑な図面を、軽やかにひらくTASTEFILES必要なファイルだけを、最速でTASTEFTPファイルが行き交う、いちばん端正な道TASTESSHサーバーとあなたを、より確かにつなぐTASTEZIPより速くまとめ、より安全にひらくTASTEWINM2つの画面で整理する、キーボード中心のファイルマネージャー

開発ツール

TASTECODERust アプリの編集・ビルド・デバッグ・テストまでひとつのウィンドウでTASTESTUDIO編集からリモートテスト、承認した AI 修正までTASTEETL値を見ながら、データを運ぶ

サーバー

TASTEREMOTE自社サーバーで運用するリモートデスクトップTASTEGEOGeoServer 互換の空間情報サーバーを Rust で作り直しますTASTEMAILメールの主導権を、もう一度自分の手に

投資

TASTESTOCKいつ・何を。自分で決めたルールどおりに動く株式自動売買

はじめる

ダウンロード全製品の最新版ドキュメント各製品の使い方購入サブスクリプション・永久ライセンスすべての製品全製品を一覧で
すべての製品
マーケットプレイスニュース
技術

ニュース

今日の開発ニュース言語・フレームワーク・GitHub・AI の公式発表開発ドキュメント言語・フレームワーク・アルゴリズムのガイド

プログラミング言語

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

フレームワーク

Webフロントエンド フレームワークNext.jsReactVue.js · NuxtSvelteKitAngular
サーバー フレームワークSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
アプリ・デスクトップ フレームワークTauriFlutterReact NativeElectron

アルゴリズム

アルゴリズムの基礎計算量解析 · ソート · 探索 · 基本データ構造 · 木構造とヒープ主要アルゴリズムグラフ探索 · 最短経路と最小全域木 · 動的計画法 · 貪欲法 · 分割統治法 · バックトラッキング発展アルゴリズム文字列アルゴリズム · 数学と整数論 · ビット演算 · セグメント木 · Union-Find実務のアルゴリズムコーディング面接対策 · LRUキャッシュ · レート制限 · コンシステントハッシュ法
開発ドキュメントをすべて見る
コミュニティ
プロジェクトビルダーと作品を探す開発ログ決定と試行錯誤プロンプト再利用できる指示AIツールの問題Claude・Codex・Gemini の問題と回避策ショーケース完成した成果コミュニティガイドオープンにつくる方法
協業
技術移転Rust・egui でネイティブアプリを作るウェブサイト構築10言語、アカウント、ドキュメントとダウンロードデスクトップアプリ構築Rust・egui、WebView なしリリース・決済パイプライン署名・MSI・deb・rpm・AppImage・ハッシュ販売パートナー紹介して決済額の30%お問い合わせ構築・提携・投資のご相談
サービス
リモートデスクトップブラウザから自分のパソコンへインストールパッケージのカスタマイズ必要な機能だけ、設定は事前に
購入
JA
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
ログイン
ログイン
TASTEDEV

小さなツールから、より良い開発へ。

support@tastedev.netTASTEDEVを支援
製品製品ラインナップ購入ドキュメントダウンロードマーケットプレイスサポート
コミュニティプロジェクト開発ログプロンプトAIツールの問題ショーケース
ポリシー会社概要プライバシーポリシー利用規約サブスクリプション規約返金ポリシーコミュニティガイドライン
アカウントログイン新規登録
訪問者
今日
昨日
累計閲覧
商号
GXSOFT
代表者
CHOI YOUNG GU
事業者登録番号
853-44-00368
所在地
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
電話
+82-10-4404-1523
メール
whitecalvin@tastedev.net
個人情報保護責任者
CHOI YOUNG GU

© 2026 TASTEDEV製品情報は検証済みの開発ソースに基づいています。リリース・改善中

ASP.NET Core ドキュメント
ASP.NET Core
Getting Started with ASP.NET CoreProject Structure and ConfigurationCore ConceptsData, Validation and AuthenticationTestingDeployment
ディスカッション

ASP.NET Core ガイド · 3/6

Core Concepts

この章は現在、英語でのみ提供しています。

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);
});
この章について質問がありますか?
前の章Project Structure and Configuration次の章Data, 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件

人気のコメント順新しい順

ログイン · ログインするとコメントできます。