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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.