Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

WebHostBuilder.ConfigureServices Method

Definition

Namespace:
Microsoft.AspNetCore.Hosting
Assembly:
Microsoft.AspNetCore.Hosting.dll
Package:
Microsoft.AspNetCore.App.Ref v10.0.0
Package:
Microsoft.AspNetCore.App.Ref v11.0.0-preview.4.26230.115
Package:
Microsoft.AspNetCore.Hosting v2.0.0
Package:
Microsoft.AspNetCore.Hosting v2.1.0
Package:
Microsoft.AspNetCore.Hosting v2.2.0
Package:
Microsoft.AspNetCore.App.Ref v3.0.1
Package:
Microsoft.AspNetCore.App.Ref v3.1.10
Package:
Microsoft.AspNetCore.App.Ref v5.0.0
Package:
Microsoft.AspNetCore.App.Ref v6.0.36
Package:
Microsoft.AspNetCore.App.Ref v7.0.5
Package:
Microsoft.AspNetCore.App.Ref v8.0.19
Package:
Microsoft.AspNetCore.App.Ref v9.0.8
Package:
Microsoft.AspNetCore.Hosting v1.0.0
Package:
Microsoft.AspNetCore.Hosting v1.1.0

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Name Description
ConfigureServices(Action<WebHostBuilderContext,IServiceCollection>)

Adds a delegate for configuring additional services for the host or web application. This may be called multiple times.

ConfigureServices(Action<IServiceCollection>)

Adds a delegate for configuring additional services for the host or web application. This may be called multiple times.

ConfigureServices(Action<WebHostBuilderContext,IServiceCollection>)

Source:
WebHostBuilder.cs
Source:
WebHostBuilder.cs
Source:
WebHostBuilder.cs

Adds a delegate for configuring additional services for the host or web application. This may be called multiple times.

public:
 virtual 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
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

Parameters

configureServices
Action<WebHostBuilderContext,IServiceCollection>

A delegate for configuring the IServiceCollection.

Returns

The IWebHostBuilder.

Implements

Applies to

ConfigureServices(Action<IServiceCollection>)

Source:
WebHostBuilder.cs
Source:
WebHostBuilder.cs
Source:
WebHostBuilder.cs

Adds a delegate for configuring additional services for the host or web application. This may be called multiple times.

public:
 virtual 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
override this.ConfigureServices : Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> -> Microsoft.AspNetCore.Hosting.IWebHostBuilder
Public Function ConfigureServices (configureServices As Action(Of IServiceCollection)) As IWebHostBuilder

Parameters

configureServices
Action<IServiceCollection>

A delegate for configuring the IServiceCollection.

Returns

The IWebHostBuilder.

Implements

Applies to


Feedback

Was this page helpful?