ASP NET Core Creates a HelloWorld sample Startup

    0

    8

    lucycodes42

    C# recipes

    The following code is a simple application that prints "Hello World!" to the console when run in development mode.

    using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder;

    using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection;

    namespace WebApp

    {

    public class Startup

    {

    public void ConfigureServices(IServiceCollection services)

    {

    }

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)

    {

    }

    public void Run(IAsyncResult result)

    {

    await result.AsyncTask().Result;

    Console.

    Shortcut: ac_helloworld_startup

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Builder;
    using Microsoft.AspNetCore.Hosting;
    using Microsoft.AspNetCore.Http;
    using Microsoft.Extensions.DependencyInjection;
    
    namespace WebApp
    {
      public class Startup
      {
        public void ConfigureServices(IServiceCollection services)
        {
        }
    
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
          if (env.IsDevelopment())
          {
            app.UseDeveloperExceptionPage();
          }
    
          app.Run(async (context) =>
          {
            await context.Response.WriteAsync("Hello World!");
          });
        }
      }
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.