各种各样的 Host Builder
各种各样的 Host Buider
If you're building for the web or writing a distributed application, you might need to use a different host builder. Consider the following list of additional host builders:
- DistributedApplicationBuilder: A builder for creating distributed apps. For more information, see .NET Aspire.
- WebApplicationBuilder: A builder for web applications and services. For more information, see ASP.NET Core.
- WebHostBuilder: A builder for IWebHost. For more information, see ASP.NET Core web host.
HostApplicationBuilder
用来构建托管的应用和服务。从 .NET 6 开始提供。
WebApplicationBuilder
用于构建 Web 应用和 Web 服务的托管器,从 .NET 6 开始提供。现在推荐的方式。
DistributedApplicationBuilder
主要用于实现 .NET Aspire 中,用来管理分布式应用。它比较新,从 .NET 8 开始提供。
WebHostBuilder
最早在 .NET Core 就提供的用于开发 Web 应用的托管器,它从 .NET 1.0 就开始提供。
WebHostBuilder 提供了便利的方式来完成对 IServer he RequestDelegate 对象的封装。它提供了 UseHttpListenerServer()
方法用来注册 HttpListener。以及 Configure()
方法用来配置 Web 服务器注册处理中间件。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2020-10-28 C# 编译器对局部变量的优化