Application_Start equivalent in ASP.NET 5

If I am not wrong from what I understood, there is no such equal method. Rather, there are two different methods, ConfigureService and Configure.

ConfigureService is a method to configure services for your project. The purpose of this method is to set dependency injection for your project. This is the method that will be fired first after constructor has been called.

Configure is a method to configure request pipeline. This method will execute after ConfigureService.

You can refer below two links :

Asp.Net 5 Startup

Asp.Net 5 Startup 2

For your last question, I did not found any other method documentation or declaration in Startup.cs class anywhere online.


As Simple Man said, there is no direct equivalent method in ASP.NET 5; similar functionality should be started by your services when appropriate in keeping with the Single Responsibility Principle. (The closest is the Configure method, which is where you should probably "start" any services that need to be "started".) However, there is one other method often overlooked in the Startup class: the constructor. Some logic, such as loading config files, may be appropriate there.

You can see how the methods are located on the Startup class in the Hosting repository. Only the two methods you mentioned and the Startup constructor are used.

Tags:

Asp.Net Core