How to do it...

  1. Your current ASP.NET Core application should contain a Configure() method that looks as follows:
        public void Configure(IApplicationBuilder app,           IHostingEnvironment env,           ILoggerFactory loggerFactory)        {          loggerFactory.AddConsole();          if (env.IsDevelopment())          {            app.UseDeveloperExceptionPage();          }         app.Run(async (context) =>         {           await context.Response.WriteAsync($"The date is              {DateTime.Now.ToString("dd MMM yyyy")}");         });       }
  1. From the Debug menu, click on Start Without Debugging or press Ctrl + F5. You will see the date displayed as follows:
  1. Go back to your code and tell your application to display the welcome page middleware. ...

Get C# 7 and .NET Core Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.