Skip to content

class WebHostBuilder

cangjie
public class WebHostBuilder

功能:提供构建 WebHost 实例的能力。

成员概览

成员功能
prop logging返回当前构建器使用的日志构建器。
prop services返回当前构建器维护的服务集合。
prop properties返回当前构建器维护的属性集合。
prop environment返回当前构建器使用的 Web 主机环境。
prop configuration返回当前构建器维护的配置管理器。
func build()构建并返回 WebHost 实例。
func configureServer((ServerBuilder) -> Unit)注册底层 HTTP 服务器的配置回调。

prop logging

cangjie
public prop logging: LoggingBuilder

功能:返回当前构建器使用的日志构建器。

类型:LoggingBuilder

prop services

cangjie
public prop services: ServiceCollection

功能:返回当前构建器维护的服务集合。

类型:ServiceCollection

prop properties

cangjie
public prop properties: HashMap<String, Any>

功能:返回当前构建器维护的属性集合。

类型:HashMap<String, Any>

prop environment

cangjie
public prop environment: IWebHostEnvironment

功能:返回当前构建器使用的 Web 主机环境。

类型:IWebHostEnvironment

prop configuration

cangjie
public prop configuration: ConfigurationManager

功能:返回当前构建器维护的配置管理器。

类型:ConfigurationManager

func build()

cangjie
public func build(): WebHost

功能:构建并返回 WebHost 实例。

返回值:

  • WebHost - 返回构建完成的 WebHost。

func configureServer((ServerBuilder) -> Unit)

cangjie
public func configureServer(configure: (ServerBuilder) -> Unit): This

功能:注册底层 HTTP 服务器的配置回调。

参数:

  • configure: (ServerBuilder) -> Unit - 用于配置底层服务器构建器的回调。

返回值:

  • This - 返回当前构建器。