O'Reilly logo

C# 7 and .NET Core Cookbook by Dirk Strauss

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required