ConfigureWebHostBuilder.ConfigureServices 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
ConfigureServices(Action<WebHostBuilderContext,IServiceCollection>) |
新增委派,以設定主機或 Web 應用程式的其他服務。 可能會多次呼叫此項。 |
ConfigureServices(Action<IServiceCollection>) |
新增委派,以設定主機或 Web 應用程式的其他服務。 可能會多次呼叫此項。 |
ConfigureServices(Action<WebHostBuilderContext,IServiceCollection>)
新增委派,以設定主機或 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>)
新增委派,以設定主機或 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 委派。