There is a newer version of the record available.

Published July 27, 2026 | Version 2026-07-27

.NET 的 Generic Host 是什麼 - 先整理 DI、設定、日誌、BackgroundService (archived 2026-07-27)

Authors/Creators

  • 1. KomuraSoft LLC

Description

本文整理 .NET Generic Host 的真面目,並把 DI、設定、日誌、IHostedService 與 BackgroundService 的關係,連同 Host.CreateApplicationBuilder 與 WebApplicationBuilder 的位置一次拉平。讀完能判斷短命主控台工具與常駐 worker 各自該怎麼用,避免過度搬入或過度省略。

Archived version of https://comcomponent.com/zh-TW/blog/2026/03/14/000-dotnet-generic-host-what-is/, as published on 2026-07-27. The live article is maintained and may change after this date. First published 2026-03-14.

Files

2026-03-14-000-dotnet-generic-host-what-is-zh-TW-2026-07-27.jekyll-source.md

Additional details