IServiceCollection
IServiceCollection is a .NET interface representing service descriptors and registrations used to configure a dependency-injection container.
ASP.NET Core in Action, 3e
IServiceCollection is the ASP.NET Core abstraction representing the collection of service registrations available to an application.
- How it is used
- Registers framework and application services that ASP.NET Core’s dependency-injection container must provide at runtime.
- How deep it goes
- Explains registration, extension methods, dependency resolution, and the Build boundary without detailing container internals.
- Examples
- Uses AddHttpLogging(), AddRazorPages(), custom services, and the Build() boundary as concrete examples.
- What you can do after
- Apply it via WebApplicationBuilder.Services to register framework features and application dependencies before building the app.
Read how ASP.NET Core in Action, 3e explains IServiceCollection →
Building Web APIs with ASP.NET Core
A service collection is a registry of application services and their dependency-injection configurations.
- How it is used
- Registers the main gRPC services in Program.cs before they enter the HTTP pipeline.
- How deep it goes
- Shows one registration call but does not descend into the collection’s internals or dependency-injection resolution process.
- Examples
- Uses builder.Services.AddGrpc() alongside app.MapGrpcService<GrpcService>() in the application startup configuration.
- What you can do after
- Operate/configure a gRPC server by registering its framework services in the application startup pipeline.
Read how Building Web APIs with ASP.NET Core explains IServiceCollection →
Also covered in
What to know first
- extensionAn extension is a language feature that lets functionality be defined outside a type's original declaration and called using that type's member-like syntax, without modifying the type.
Related concepts
- dependency injectionused by · Dependency injection is a software design technique in which a component receives its dependencies from outside rather than creating or locating them internally.
- ServiceRegistryincludes · ServiceRegistry is Lamar's service-registration type for configuring registered services and their dependencies.
- services propertyincludes · The Services property is a WebApplicationBuilder property exposing the service collection used to register application and framework dependencies for dependency injection.
- constructor injectionused by · Constructor injection is a dependency-injection technique in which an object's dependencies or required values are supplied through its constructor when it is created.
- HostBuilderused by · HostBuilder is a .NET hosting API type that configures and constructs an application host.
Questions about IServiceCollection
What is IServiceCollection?
IServiceCollection is a .NET interface representing service descriptors and registrations used to configure a dependency-injection container.
Which Manning books explain IServiceCollection?
ASP.NET Core in Action, 3e and Building Web APIs with ASP.NET Core.
What should I know before learning IServiceCollection?
Manning books that teach IServiceCollection usually introduce extension first.
What kinds of IServiceCollection are there?
Kinds of IServiceCollection include ServiceRegistry and services property.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

