ConfigureWebHostBuilder.ConfigureServices 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
ConfigureServices(Action<WebHostBuilderContext,IServiceCollection>) |
添加一个委托,用于为主机或 Web 应用程序配置其他服务。 这可多次进行调用。 |
ConfigureServices(Action<IServiceCollection>) |
添加一个委托,用于为主机或 Web 应用程序配置其他服务。 这可多次进行调用。 |
ConfigureServices(Action<WebHostBuilderContext,IServiceCollection>)
- Source:
- ConfigureWebHostBuilder.cs
添加一个委托,用于为主机或 Web 应用程序配置其他服务。 这可多次进行调用。
public Microsoft.AspNetCore.Hosting.IWebHostBuilder ConfigureServices (Action<Microsoft.AspNetCore.Hosting.WebHostBuilderContext,Microsoft.Extensions.DependencyInjection.IServiceCollection> configureServices);
abstract member ConfigureServices : Action<Microsoft.AspNetCore.Hosting.WebHostBuilderContext, Microsoft.Extensions.DependencyInjection.IServiceCollection> -> Microsoft.AspNetCore.Hosting.IWebHostBuilder
override this.ConfigureServices : Action<Microsoft.AspNetCore.Hosting.WebHostBuilderContext, Microsoft.Extensions.DependencyInjection.IServiceCollection> -> Microsoft.AspNetCore.Hosting.IWebHostBuilder
Public Function ConfigureServices (configureServices As Action(Of WebHostBuilderContext, IServiceCollection)) As IWebHostBuilder
参数
- configureServices
- Action<WebHostBuilderContext,IServiceCollection>
用于配置 的 IServiceCollection委托。
返回
实现
适用于
ConfigureServices(Action<IServiceCollection>)
- Source:
- ConfigureWebHostBuilder.cs
添加一个委托,用于为主机或 Web 应用程序配置其他服务。 这可多次进行调用。
public Microsoft.AspNetCore.Hosting.IWebHostBuilder ConfigureServices (Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> configureServices);
abstract member ConfigureServices : Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> -> Microsoft.AspNetCore.Hosting.IWebHostBuilder
override this.ConfigureServices : Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> -> Microsoft.AspNetCore.Hosting.IWebHostBuilder
Public Function ConfigureServices (configureServices As Action(Of IServiceCollection)) As IWebHostBuilder
参数
- configureServices
- Action<IServiceCollection>
用于配置 的 IServiceCollection委托。