Startup.cs class in ASP.NET Core - ProgramIdea

Startup.cs class in ASP.NET Core

The startup.cs class is where you define the request handling pipeline and where any services needed by app are configured. It must be public. It has two methods configure() & ConfigurationServices(). startup class can optinally include a ConfigurationServices() method to configure app's services. startup class must include a configure() method to create the app's request processing pipeline.


ConfigurationServices() method is used for configuring services that are used by application. It's optional, you can ignore if you donn't have any service registration requirend in the application. AddMvc() is a service that used for Mvc functionalities.


Conigure() method is used for handling http request pipeline by adding middlewares. Middleeware performs asynchronous operations on HttpContext and then invoke next middleware in pipeline or terminates the request. UseMvc() is a middleware that is used for Mvc functionalities.