共用方式為


IWebHostBuilder.ConfigureServices 方法

定義

多載

ConfigureServices(Action<WebHostBuilderContext,IServiceCollection>)

新增委派,以設定主機或 Web 應用程式的其他服務。 可能會多次呼叫此項。

ConfigureServices(Action<IServiceCollection>)

新增委派,以設定主機或 Web 應用程式的其他服務。 可能會多次呼叫此項。

ConfigureServices(Action<WebHostBuilderContext,IServiceCollection>)

來源:
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>)

來源:
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

適用於