冠军

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

各种各样的 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.

见:https://learn.microsoft.com/en-us/dotnet/core/extensions/generic-host?tabs=appbuilder#additional-scenario-based-host-builders

HostApplicationBuilder

用来构建托管的应用和服务。从 .NET 6 开始提供。

见:https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.hosting.hostapplicationbuilder?view=net-8.0

WebApplicationBuilder

用于构建 Web 应用和 Web 服务的托管器,从 .NET 6 开始提供。现在推荐的方式。

见:https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.webapplicationbuilder?view=aspnetcore-8.0

DistributedApplicationBuilder

主要用于实现 .NET Aspire 中,用来管理分布式应用。它比较新,从 .NET 8 开始提供。

见: https://learn.microsoft.com/en-us/dotnet/api/aspire.hosting.distributedapplicationbuilder?view=dotnet-aspire-8.0

WebHostBuilder

最早在 .NET Core 就提供的用于开发 Web 应用的托管器,它从 .NET 1.0 就开始提供。

WebHostBuilder 提供了便利的方式来完成对 IServer he RequestDelegate 对象的封装。它提供了 UseHttpListenerServer() 方法用来注册 HttpListener。以及 Configure() 方法用来配置 Web 服务器注册处理中间件。

见:https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.webhostbuilder?view=aspnetcore-8.0

posted on   冠军  阅读(45)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
历史上的今天:
2020-10-28 C# 编译器对局部变量的优化
点击右上角即可分享
微信分享提示