IWebHostBuilder.ConfigureServices 方法

定义

重载

ConfigureServices(Action<WebHostBuilderContext,IServiceCollection>)

添加一个委托,用于为主机或 Web 应用程序配置其他服务。 这可多次进行调用。

ConfigureServices(Action<IServiceCollection>)

添加一个委托,用于为主机或 Web 应用程序配置其他服务。 这可多次进行调用。

ConfigureServices(Action<WebHostBuilderContext,IServiceCollection>)

Source:
IWebHostBuilder.cs

添加一个委托,用于为主机或 Web 应用程序配置其他服务。 这可多次进行调用。

public:
 Microsoft::AspNetCore::Hosting::IWebHostBuilder ^ ConfigureServices(Action<Microsoft::AspNetCore::Hosting::WebHostBuilderContext ^, Microsoft::Extensions::DependencyInjection::IServiceCollection ^> ^ configureServices);
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
Public Function ConfigureServices (configureServices As Action(Of WebHostBuilderContext, IServiceCollection)) As IWebHostBuilder

参数

configureServices
Action<WebHostBuilderContext,IServiceCollection>

用于配置 的 IServiceCollection委托。

返回

IWebHostBuilder

适用于

ConfigureServices(Action<IServiceCollection>)

Source:
IWebHostBuilder.cs

添加一个委托,用于为主机或 Web 应用程序配置其他服务。 这可多次进行调用。

public:
 Microsoft::AspNetCore::Hosting::IWebHostBuilder ^ ConfigureServices(Action<Microsoft::Extensions::DependencyInjection::IServiceCollection ^> ^ configureServices);
public Microsoft.AspNetCore.Hosting.IWebHostBuilder ConfigureServices (Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> configureServices);
abstract member ConfigureServices : Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> -> Microsoft.AspNetCore.Hosting.IWebHostBuilder
Public Function ConfigureServices (configureServices As Action(Of IServiceCollection)) As IWebHostBuilder

参数

configureServices
Action<IServiceCollection>

用于配置 的 IServiceCollection委托。

返回

IWebHostBuilder

适用于