Introduction
This article explains about ASP.NET Core using Visual Studio 2017 and how to create ASP.NET Core applications in simple ways. Before reading this article, please read the previous part of this article at the below link.
Summary of the previous article
The previous part explained Kestrel, Content Root, Startup class, Application Insights, and Dependencies. This article continues that information and will explain about Configure method in a detailed way and how to develop a simple application with a simple example page.
Configure Method
This is a void method and it is called at run time. We use this method to configure the HTTP request pipeline. The configured class contains three parameters and these three parameters are an interface.
- public void Configure(IApplicationBuilder app,IHostingEnvironment env,ILoggerFactory loggerfactory)
- {
- //Codings
- }
IApplicationBuilder
IApplicationBuilder is an interface. It's name space is “Microsoft.AspNetCore.Builder”. It defines a class that provides the mechanisms to configure an application's request pipeline. IApplicationBuilder contains properties and methods.
- namespace Microsoft.AspNetCore.Builder
- {
- public interface IApplicationBuilder
- {
- IServiceProvider ApplicationServices { get; set; }
- IFeatureCollection ServerFeatures { get; }
- IDictionary<string, object> Properties { get; }
- RequestDelegate Build();
- IApplicationBuilder New();
- IApplicationBuilder Use(Func<RequestDelegate, RequestDelegate> middleware);
- }
- }
IHostingEnvironment
IHostingEnvironment is an interface and it's name space is “Microsoft.AspNetCore.Hosting”. It provides information about the web hosting environment an application is running on. It contains many properties; we can see the properties in the below code.
- namespace Microsoft.AspNetCore.Hosting
- {
- public interface IHostingEnvironment
- {
- string EnvironmentName { get; set; }
- string ApplicationName { get; set; }
- string WebRootPath { get; set; }
- IFileProvider WebRootFileProvider { get; set; }
- string ContentRootPath { get; set; }
- IFileProvider ContentRootFileProvider { get; set; }
- }
- }
ILoggerFactory
ILoggerFactory is another one of the interfaces. It's name space is “Microsoft.Extensions.Logging”. It represents a type used to configure the logging system and create instances of ILogger from the registered ILoggerProviders.
- namespace Microsoft.Extensions.Logging
- {
- public interface ILoggerFactory : IDisposable
- {
- void AddProvider(ILoggerProvider provider);
- ILogger CreateLogger(string categoryName);
- }
- }
Run Application
We will simply build and run our demo ASP.NET Core application. Our demo application does not have any simple code right now. We are going to add some set of coding at Configure method in the Startup class, then run our application.









Join the conversation! Your thoughts help the community grow.