What is the difference between ConfigureServices and Configure methods?

  • ConfigureServices() and Configure() methods are used to register services and configure components within the request pipeline respectively.
  • ConfigureServices() takes a parameter of type IServiceCollection.
  • Configure() takes a parameter of type IApplicationBuilder with possible parameters of any Service which is registered in the ConfigureServices() method.
  • an application should contain an ConfigureServices() method with an optional Configure() method.
public class Startup
{
    public void ConfigureServices(IServiceCollection services) 
    {
    }
    public void Configure(IApplicationBuilder app)
    {
    }
}
  • ConfigureServices() and Configure() methods are used to register services and configure components within the request pipeline respectively.
  • ConfigureServices() takes a parameter of type IServiceCollection.
  • Configure() takes a parameter of type IApplicationBuilder with possible parameters of any Service which is registered in the ConfigureServices() method.
  • an application should contain an ConfigureServices() method with an optional Configure() method.
public class Startup
{
    public void ConfigureServices(IServiceCollection services) 
    {
    }
    public void Configure(IApplicationBuilder app)
    {
    }
}
Default image
Sriram Mannava

I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity.

Leave a Reply