Skip to main content

Posts

Showing posts with the label Configure

Configure vs ConfigureServices in ASP.NET Core 2.0

Both words sound similar but there is a very thin line which differentiates these two. Let’s have a look at key differences between these two methods. Configure ConfigureServices Main purpose Does all the initial setup Does service configurations Default Location Resides in Startup.cs Resides in Startup.cs Execution sequence Hits prior to ConfigureServices Hits after Configure Ordering Order of steps mentioned in this method matters Order of the statements written to add services doesn’t matter HTTP request HTTP request first hits in this method                                  - Parameters Configure(IApplicationBuilder app, IHostingEnvironment env) ConfigureServices(IServiceCollection services) Middleware Setting up all the middleware are done in this method