Using middleware on ASP.NET Core 3.0 and later
In ASP.NET Core 3.0 and later, the Configure()
method looks different. There are two new kinds of middleware elements, called UseRouting
and UseEndpoints
:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await context.Response.WriteAsync("Hell World!"); }); }); }
The first one is a middleware that uses...