Startup.cs

public class Startup { public void ConfigureServices(IServiceCollection services) { } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. puplic void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.Run(async (context) => { await context.Response.WriteAsync("Hello World!"); }); } }
ASP.NET Core Startup Class The configuration of the execution pipeline of an ASP.NET Core application is done via the Configure method of the Startup class. At its simplest this method needs a parameter of type IApplicationBuilder to receive an instance of the application builder, which is used to assemble together all middleware components. shows the code of the Startup class created by the empty project template. It has two methods, ConfigureServices and the aforementioned Configure. ConfigureServices is covered later in this chapter, when talking about dependency injection, so you’ll focus on the Configure method for the moment.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.