Google News
logo
ASP.NET - Interview Questions
What is the purpose of the Startup class?
This class handles two important aspects of your application, namely service registration, and middleware pipeline.
 
Services are C# classes that your application depends on for providing additional functionality, both used by the framework and your application. Examples include logging, database, etc. These services must be registered to be instantiated when your app is running and when it needs them.
 
The middleware pipeline is the sequence in which your application processes an HTTP request (the next question explains the concept of Middleware in detail).
 
Startup class contains two methods : ConfigureServices() and Configure(). As the name suggests, the first method registers all the services that the application needs. The second method configures the middleware pipeline.
Advertisement